Entry
How can I redirect the browser to a different site (I don't need to pass variables)?
Nov 13th, 2005 03:44
Matthew Wilkinson, Robert Boyer,
There are several ways.
The easiest is to just send header('Location:
http://www.you.com/hello'); where you.com/hello is the webpage you want
ot redirect to. You must include the http:// or https:// or ftp:// etc.
This way works, but it is not very user friendly, especially to screen
readers etc.
To send it properly, you should send a HTTP code such as Temporary
Redirect or Permanent Redirect. You would do this using the coe below:
header('HTTP/1.1 301 Moved Permanently');
--OR--
header('HTTP/1.1 307 Temporary Redirect');
--THEN--
header('Location: http://www.you.com/hello');