WWW FAQ: How can I redirect the browser to a different page?


How can I redirect the browser to a different page?

It is possible to redirect the browser to a different URL, effectively "forwarding the call" to a different page. To do this, either take advantage of the redirection features offered by your web server or write a CGI program which outputs the following:
Location: http://desiredsite.com/desiredpath/document.html

Note that two line breaks must follow this line.

A few older browsers may have difficulty following such directives. You can combat this problem by outputting a short page of HTML to the user after the above information, explaining that the page has moved.

There are also a few browsers which expect to see a URI: header as well as a Location: header. If you wish to be agonizingly thorough, output both headers before the double line break.


World Wide Web FAQ