|
|
|
|
The code below should redirect the user to another page, but doesn't.
What is wrong?
Zach
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Under reconstruction</title>
</head>
<body>
<?php
// Redirect the user to the welcome page!
header ('Location: www.aaa.yy/index.html/');
exit();
?>
</body>
</html>
| |
| Janwillem Borleffs 2007-12-31, 7:00 pm |
| Zach wrote:
> The code below should redirect the user to another page, but doesn't.
> What is wrong?
>
The header function can only be applied without previous output. In other
words, the page should start with the function call and exit immediately.
See: http://www.php.net/header
JW
| |
|
| Zach wrote:
> The code below should redirect the user to another page, but doesn't.
> What is wrong?
a) You can't send an HTTP header AFTER any content has been displayed
(unless you work around this by enabling output buffering).
b) Location: demands a full URL. Ie, it should begin with "http://".
regards, f.
| |
|
| do you mean only
<?php
// some code
?>
and nothing else?
Zach
Zach wrote:
>
> The code below should redirect the user to another page, but doesn't.
> What is wrong?
> Zach
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
> <title>Under reconstruction</title>
> </head>
> <body>
> <?php
> // Redirect the user to the welcome page!
> header ('Location: www.aaa.yy/index.html/');
> exit();
> ?>
> </body>
> </html>
| |
| Guillaume BASSINET 2007-12-31, 7:00 pm |
| Zach a écrit :[color=darkred]
> do you mean only
>
> <?php
> // some code
> ?>
>
> and nothing else?
>
> Zach
>
> Zach wrote:
yep! only php!!!
| |
|
| Thanks mate,
Zach
Guillaume BASSINET wrote:
> Zach a écrit :
>
> yep! only php!!!
| |
|
| How do I deal with this error??
This error (HTTP 403 Forbidden) means that Internet Explorer was able to
connect to the website, but it does not have permission to view the webpage.
Zach.
Zach wrote:[color=darkred]
> Thanks mate,
> Zach
>
> Guillaume BASSINET wrote:
| |
|
| Janwillem Borleffs wrote:
> The header function can only be applied without previous output. In other
> words, the page should start with the function call and exit immediately.
Not really.
What happens AFTER the call is irrelevant as it never gets executed.
What happens BEFORE the call can be ANYTHING provided it doesen't send
ANY output to the browser.
regards, f.
| |
|
| Zach wrote:
> How do I deal with this error??
Did you pass a FULL URL in header ('Location: ') ?
A full URL starts with "http://"
regards, f.
| |
|
| I had that already. So not the cause.
Zach
Cujo wrote:
> Zach wrote:
>
>
> Did you pass a FULL URL in header ('Location: ') ?
>
> A full URL starts with "http://"
>
> regards, f.
| |
| www.j2be.com 2008-01-01, 7:59 am |
| "Zach" <xx@xx.xx> ha scritto nel messaggio
news:47790757$0$24413$5fc3050@news.tiscali.nl...
>
> The code below should redirect the user to another page, but doesn't. What
> is wrong?
> Zach
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
> <title>Under reconstruction</title>
> </head>
> <body>
> <?php
> // Redirect the user to the welcome page!
> header ('Location: www.aaa.yy/index.html/');
> exit();
> ?>
> </body>
> </html>
The header ('Location: www.aaa.yy/index.html/'); must be on the top of all
the code before any output.
You can use a meta refresh in the html to redirect without fancy headers.
| |
|
| Zach wrote:
> I had that already. So not the cause.
Copy and paste the "Location" you are redirecting to in your browser. If
you get the same error, the problem is obviously not related to php.
Check your web server configuration.
regards, f.
| |
|
| Ok I'll try that.
Zach
www.j2be.com wrote:
>snipped
> You can use a meta refresh in the html to redirect without fancy headers.
>
>
| |
|
| I don't think I can reconfigure setings at the ISP.
The address is OK.
Thanks,
Zach.
Cujo wrote:
> Zach wrote:
>
>
> Copy and paste the "Location" you are redirecting to in your browser. If
> you get the same error, the problem is obviously not related to php.
>
> Check your web server configuration.
>
> regards, f.
| |
| Michael Fesser 2008-01-01, 7:01 pm |
| ..oO("www.j2be.com" <info@[nospam[j2be.com> )
>The header ('Location: www.aaa.yy/index.html/'); must be on the top of all
>the code before any output.
>You can use a meta refresh in the html to redirect without fancy headers.
Of course you don't want to do that. The HTTP header is the way to go.
Micha
| |
|
| www.j2be.com wrote:
> You can use a meta refresh in the html to redirect without fancy headers.
Bleah !
regards, f.
| |
|
| Zach wrote:
> I don't think I can reconfigure setings at the ISP.
> The address is OK.
You mean: The following:
header ('location: http://somewhere.com');
gives you a "HTTP 403 Forbidden", whereas typing
the *exact* (including trailing slashes, etc.) same url
paste into your browser does *not* ?
Are you sure ? I can't see how it could be possible ...
What happens if you do:
header ('location: http://www.google.com');
Does your page redirect correctly to google ?
regards, f.
| |
|
| I have done the alternative thing
<meta http-equiv="refresh" content="0;url=http://www.blabla.blo">
and that does work fine.
Many thanks all.
Zach.
Cujo wrote:
> Zach wrote:
>
>
> You mean: The following:
>
> header ('location: http://somewhere.com');
>
> gives you a "HTTP 403 Forbidden", whereas typing
> the *exact* (including trailing slashes, etc.) same url
> paste into your browser does *not* ?
>
> Are you sure ? I can't see how it could be possible ...
>
>
> What happens if you do:
>
> header ('location: http://www.google.com');
>
> Does your page redirect correctly to google ?
>
> regards, f.
| |
| Michael Fesser 2008-01-02, 7:00 pm |
| ..oO(Zach)
>I have done the alternative thing
>
><meta http-equiv="refresh" content="0;url=http://www.blabla.blo">
>
>and that does work fine.
It doesn't
Use standard redirects: don't break the back button!
http://www.w3.org/QA/Tips/reback
Micha
| |
|
| In-Reply-To: <tgqnn3h37j9u38qt3np635bv91kq9rgo04@4ax.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 18
Message-ID: <477ec209$0$24403$5fc3050@news.tiscali.nl>
Organization: Tiscali
NNTP-Posting-Date: 05 Jan 2008 00:32:25 CET
NNTP-Posting-Host: 46108165.news.tiscali.nl
X-Trace: DXC=XNhJ;GDmTaHeV;>Kc]gB5GB>BklU>=_UEJGBYkgPmY@BXl;G=Bo7RkA:I>fI8h_4]M^Pd@jdLB@eA
X-Complaints-To: abuse@tiscali.nl
Bytes: 1862
Xref: number1.nntp.dca.giganews.com alt.comp.lang.php:43362
oO(h dear) to think I was happy that I finally got it to work...
Zach.
Michael Fesser wrote:
> .oO(Zach)
>
>
> It doesn't
>
> Use standard redirects: don't break the back button!
> http://www.w3.org/QA/Tips/reback
>
> Micha
| |
|
|
|
|