Canonical URL Issue, need help

aansy

Newbie
Joined
Aug 6, 2011
Messages
22
Reaction score
2
hi,

My website in google webmaster tools is added with both non ww and with ww plus domain name and both are redirecting it to non ww. but when i browse it with ww, it does not redirect it to the non ww URL.

All helpful suggestions will be highly appreciated.

Thanks
 
Modify htaccess to only work with non ww

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.yoursite\.com [NC]
RewriteRule (.*) http://yoursite.com/$1 [R=301,L]
 
after updating it with my domain name, i should put it on the httaccess file right. just these 3 code lines, right?
 
Yep, just edit your domain in. If your htaccess file doesn't exist, just those 3 lines will do within a newly created htaccess file. If it exists, just prepend it to what's already in the file.

Also, remember that it's ".htaccess" - spelled exactly like that, with the period included (a good way to view it if it's confusing is as a file with no file name and "htaccess" as the file extension).
 
if your using wordpress for your blog its much easier. but if not then htaccess is the solution
 
Were you able to get everything sorted to your needs?
 
Back
Top