Search Form

301 redirect the best way

A lot of us webmasters from time to time will need to redirect traffic from one domain to another. We all know the best way to do this is with a 301 redirect but what is the best way to implement it?

(This assumes you are using the Apache webserver. If you are not… you should be.)

If you are the server admin and have direct access to the apache configuration file you can just put in:

redirect 301 / http://www.you.com/

in the VirtualHost Directive.

If you have a .htaccess file:

just put this as the last line after your other rules.

redirect 301 / http://www.you.com/

The first “/” indicates that everything from the top level of the site down should be redirected. As long as you are using the same paths and filenames, then this option is a very simple way to perform site redirection in the situation where you have only changed your domain name.



Please read this disclaimer before acting on this post.
  • 2 comments. What say you?
    • RSS

Comments

  1. Harish

    good post man.Informative

  2. Ken Savage

    nice tutorial Jeremy

Trackbacks url:

By commenting on this post you agree to the comment policy

Leave a Comment...