Avoid duplicate content on Google while your site accessible by both www/non-www URL
Hey Guys,
It has been issued about duplicate content as well as has Google Canonical problem when your site accessible both under your_domain.com and www.your_domain.com.
For ex.:
To avoid such problems you can use the following lines in your .htaccess file,
For www version of your web:
By Canonical Tag:
The Canonical Tag look like this:
<link rel=”canonical” href=”http://www.example.com”/>
You have to simply add this tag inside (HEAD) section and also specify your preferred version of a URL.
This is a great step to help cleaning up the Web of duplicate content.
Best Regards :)
Gaurav Mehta
It has been issued about duplicate content as well as has Google Canonical problem when your site accessible both under your_domain.com and www.your_domain.com.
For ex.:
www.example.com example.com www.example.com/index.html
The socking fact is that, these all are different URLs. From the search engine perspective, this can cause bit of an issue.
To avoid such problems you can use the following lines in your .htaccess file,
For www version of your web:
RewriteEngine on RewriteCond %{HTTP_HOST} !^www.your_domain.com$ RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301]For Non-www version of your web:
RewriteEngine on RewriteCond %{HTTP_HOST} ^www.your_domain\.com$ [NC] RewriteRule ^(.*)$ http://your_domain.com/$1 [R=301,L]Another Way is :
By Canonical Tag:
The Canonical Tag look like this:
<link rel=”canonical” href=”http://www.example.com”/>
You have to simply add this tag inside (HEAD) section and also specify your preferred version of a URL.
This is a great step to help cleaning up the Web of duplicate content.
Best Regards :)
Gaurav Mehta
Comments
Post a Comment