Stable, unique URLs: Methods for automated redirection

An often used methods to redirect visitors from an outdated location to the current one is to put a (script) file on the original location that points the visitor to the relocated content. Such pages may use the following techniques.

HTTP headers

Browsers and web servers communicate with each other using the HTTP protocol. In a so-called HTTP header the browser sends a request for a page. The web server receives the request and responds with a series of headers, such as HTTP/1.0 200 OK (when the URL is correct), or HTTP/1.0 404 Not Found (when the page does not exist). Upon receiving the answer, the browser can request a follow-up action, such as downloading the requested page and displaying it on the browser screen.

A method to make the server respond by redirecting the browser to a new location, is HTTP/1.0 301 Moved, immediately followed by Location: http://newlocation. The browser now knows what to do and tries the suggested URL. Some browsers are even capable of adapting the outdated bookmark.

These HTTP headers can be sent by a local server configuration in a directory, for example by placing a .htaccess file (Apache web server), or a file with server side script, such as PHP.

The advantages of HTTP headers are:

  • It is not necessary to download a page or a script that handles the redirect. Redirection is done server-side.
  • It does not break the Back button functionality of the browser.
  • 100% support by browsers and search engine spiders.
  • Ease of implementation in server-side scripts.

A disadvantage is that it requires access to the (sub) configuration of the web server. It also requires access to and knowledge from server-side scripts by web developers.

Automatic redirection should be carried by the server if possible.

Guideline R-pd.4.5

Meta-refresh redirection

This method is based on applying an HTML element in the source code of a page. The browser downloads the page from the requested location and, when it recognises the element, redirects the visitor the URL available in the meta element. This element has the following syntax:

Example of a meta element for redirection (HTML)

<meta http-equiv="refresh" content="0; http://newlocation">

The advantage of this method is that the web developer does not need to deal with server configuration or server-side scripts. Limited access to a server by a web developer should be the most important reason for using this method. The disadvantages are:

  • The browser must download and display the page with this HTML element, which consumes bandwidth and, more important, may cause an unwanted visual effect
  • It breaks the Back button functionality of the browser, because the page containing the redirection will become part of the history in the browser; returning to this page will lead again to an automated redirect.
  • The support is limited, due to the differences in browsers and the reluctance of some search engine spiders to follow the redirects.
  • Due to the limited support, a link should be included in the HTML for the visitor to follow as emergency solution.

A third method is redirection using a client-side script. This method is similar to the meta-refresh method, but is even less widely supported. Especially search engine spiders are not able to handle this method correctly. For this reason, automatic redirection via client-side scripting is strongly discouraged.


Web Guidelines version 1.3, November 2007.