2

301 redirect the best way

Posted September 12th, 2005 by Jeremy Schoemaker

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.

Disclaimer

Before acting on this post, be sure to read my Disclaimer.

- Comment Likes - Comment Dislikes

2 comments. What say you?

  1. Good Comment?
    Harish

    good post man.Informative

  2. Good Comment?
    Ken Savage

    nice tutorial Jeremy

Join the Discussion

*Discount rate good on new registrations only. Credits or refunds cannot be issued on previous registrations. Discount rate good through February 6, 2010, prevailing rate applies after that.