Redirect Methods

Redirecting visitors from one page or domain to another

Meta refresh tag: The W3C Web Content Accessibility Guidelines recommends that the meta tag not be used as a timed redirect so as not to break the browser history. Once redirected, the visitor can no longer use the back button to get back to where they were.

However, the immediate meta redirect does not break the back button. This is a client-side technique using the meta tag:


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>     
    <title>Meta Redirect Example</title>     
    <meta http-equiv="refresh" content="0; url=http://www.example.com/newpage" />
  </head>   
  <body>     
    <p>Please view our <a href="http://www.example.com/newpage">new site</a>.</p>
  </body> 
</html>

htaccess Redirect: The favoured method is a server-side technique using an .htaccess file, though you need to be careful how you use this file.

Create a file called .htaccess and save it with the following code to the root directory of your domain:


Redirect / http://www.faithhopelove.ca/

For example, you’ll notice that www.faithhopelovemagazine.com redirects you to www.faithhopelove.ca.

Note that when you create a file name with a dot at the beginning, the file will be invisible to most operating systems (see tips) unless you use a tool such as Transmit from Panic that allows you to view invisible files.

comments | date posted posted Wednesday July 13, 2005

The Builders Collective

The Builders Collective is about building community and building a repository of ideas, techniques and code for building a better world wide web.

Articles Archive > View Recent