Home | All Questions | alt.html FAQ > Server-side basics

How do I redirect users to a new page?

By using HTTP redirection. It's probably simpler than you think (and simpler than the unreliable surrogates), as soon as you look at the right place - the server documentation. It's not really an HTML issue; HTTP is happy to deal with any type of data, and redirecting a URL to another is its daily job.

Contrary to popular belief, redirection is a function of the server, not an HTML tag. If you have a NCSA or Apache server you can redirect from one URL to another by creating a file called .htaccess. In that file place the following: Redirect oldvirtualURL newURL

Change oldvirtualURL to the path of the old URL and newURL to the path of the new url. An example of a redirection would be: Redirect /path/to/file.html http://www.domain.com/newpath/to/file.html

The "meta refresh" tag is a Netscape incarnate and doesn't work in all browsers. If you use this solution you should always include a link within the document to the new page. Meta tags are placed within the

<head> tags and after the the <title> tag. Replace [S] with the number of seconds to wait before refreshing, and [http://www.domain.com/page.html] with the URL of the page you wish to "refresh" to: <META HTTP-EQUIV="Refresh" CONTENT="S;URL=http://www.domain.com/page.html">

Recommended Resources


Related Questions