Home » 2009 » February » How do I change my .htaccess for SEO

How do I change my .htaccess for SEO

By Richard Woolmer, Monday, 16th February 2009

AddThis Social Bookmark Button   AddThis Feed Button

.htaccess files permit you to modify the way that your site or a definite directory on your site behaves. For an instance, if you put an .htaccess file in your root directory, it will have an effect on your entire site (www.example.com). If you put it in a /content directory, it will have an effect on that directory (www. example.com/content) only.

The canonical issues of .htaccess and SEO:

.htaccess file is a straightforward ASCII file can be created with any text editor. It is a file extension, so you can't make it something like "example.htaccess" or "sitename.htaccess". The file is to be named .htaccess only.

.htaccess works inside the folder it exists in and all sub folders until there is no other .htaccess file in any of these sub folders. There can be numerous such files on your server, each of them defining dissimilar parameters on your server.

Solving Google canonical issue with .htaccess file:

Google search engine reacts differently for those websites with "www" and without "www". Therefore Page Ranks may be set by Google to those websites differently. For an example "example.com" and "www.example.com" will be different URL's for Google and they may hold different Page Rank. That is certainly not at all a good condition for SEO purpose as you should all the time try to keep as much link as possible for your sites.

This problem can now be resolved. All you need to do is to insert the below code to your .htaccess file and place it in the same folder as your homepage.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^(.*) http://www.domain.com/$1 [QSA,L,R=301]

Exchange domain with your domain name. That's it. All your traffic will be enduringly forwarded from a website without "www" to your website with "www". Now you can maintain all your Page Rank on your websites without contradicting to any canonical issue on your website.

Alternatively, if you prefer to forward all traffic to your website without "www" to your website apply the below code in your .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^(.*) http://domain.com/$1 [QSA,L,R=301]

Interested in learning more? Profit Lance is packed full of tips and tricks to help you get started right away.

AddThis Social Bookmark Button   AddThis Feed Button

About The Author

The Affiliate Marketing Specialist is guiding both novice and experts with his internet marketing ideas here at http://www.profitlancebonus.com/.

Previously on SearchEngineChannel

Subscribe

RSS Feed  

Web Resources

Article Authors