May
7
2009
7
2009
Force www vs non-www to avoid duplicate content on Google Search
When you have your site accessible both under your_domain.com and www.your_domain.com you may come up with duplicate content on Google Search. To avoid such problems you can use the following lines in your .htaccess file to force only the www version of your web site:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.your_domain.com$
RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301]
Note that the .htaccess should be located in the web site main folder.
This will redirect all requests to the non-www version of your site to the www version using 301 Permanent redirect which will make the search engines to index your site only using the www.your_domain.com URL. In this way you will avoid a duplicate content penalty.
Related Posts
Leave a comment
Categories
- Diary (10)
- IT (19)
- Programming (6)
- Life (6)
- LTT App Store (1)
- Mechatronics (6)
- Others (1)
EverBot.com
EverBot twitter
- Looking forward to seeing Ice Cream Sandwich on my old little Desire. Gonna be in-ter-rest-ting! 2 months ago
- I've learned that everything is uncertain. 4 months ago
- Every morning starts freshly and energetically when I think of YOU <3 4 months ago
- what makes you happy? 4 months ago
- I'm number 4 =) 5 months ago
An article by





