NYCPHP Meetup

NYPHP.org

[nycphp-talk] redirect problem

Dan Cech dcech at phpwerx.net
Wed Dec 15 15:12:12 EST 2004


John Nunez wrote:
> I think the problem is with the browser specs.  Using header( 'location: 
> http://...com' ); cause the browser to receive a Error Code #302(?) and 
> it will redirect to the new url that has been supplied but it's a 
> temporary redirect. On refresh the browser will attempt the original 
> url.  The method I use to fix this is:
> echo '<script 
> language="Javascript">location.href="http://...com"</script>';
> 
> There might be a better/proper way of re-directing the browser.

Another method is to use an http-equiv meta element:

<meta http-equiv="Refresh" content="5;url=http://www.example.com" />

which doesn't require JavaScript.

Dan



More information about the talk mailing list