301 Permanent redirects with Apache

Following on from my previous posts on 301 redirects, if you have access to the IIS administrator or to the Apache httpd.conf file, you can achieve the same outcome without any server side processing and have the redirect handled faster via the webserver. The 301 status code is used to indicate that a page has […]
June 15, 2007 6:10 pm

Following on from my previous posts on 301 redirects, if you have access to the IIS administrator or to the Apache httpd.conf file, you can achieve the same outcome without any server side processing and have the redirect handled faster via the webserver. The 301 status code is used to indicate that a page has permanently moved, you would want to use this for many reasons:

  • Your page has moved
  • You have changed server languages e.g. use of .cfm instead of .php
  • Search engine optimisation – www. vs no www prefix on your domain

So lets look at how we do this in Apache, and soon we will do IIS.

Apache is pretty easy – you can simply add in one of the following lines:

Redirect permanent /one http://www.sixfive.co.uk/two

or

note the use of permanent or the status code after the Redirect directive. If you use:

this will return a 302 temporarily moved page redirect, which, for Search Engine Optimisation purposes isn’t the best as the Search engine will keep coming back to that page.

Leave a Comment

Login
Log in below to access your courses.
Log In With Google
Forgot Password
Enter your email address or username and we’ll send you instructions to reset your password.