Internet Business Blog

Friday, March 21, 2008

How to Create a 301 Redirect

For SEO purposes you may want to ensure that if someone types in the URL of your website without the "www", that it will redirect to the URL with the "www". E.g. I may want to redirect http://homebiz-direct.com to http://www.homebiz-direct.com

This will ensure that search engines see each of these links as the same and may boost your link popularity.

It is quite easy to make this change. All you need to do is edit your .htaccess file. This file can be found in the main directory on your web server.

Just add the following four lines to this file:

For a 301 redirect you will need to edit your .htaccess file. This can be found in your webepanel in the file manager (or in the main directory if you are uploading by ftp).

Edit this file and add the following lines to it:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourwebsite.com [NC]
RewriteRule ^(.*)$ http://www.yourwebsite.com/$1 [L,R=301]


In each case replace yourwebsite.com with your own domain name. The third line does not have the "www" but the fourth line does.

Labels: