Reputation: 644
I am having an issue with a site which doesn't open with www but it works without www.
www and non-www site show different IP address. I know DNS CNAME is missing for wwww. But the case is i am working for a client which is out of contact for few days. So, I couldn't get the domain login details to modify CNAME. I tried writing redirection rule in .htacess but it doesn't show any effect.
Is there any other way to fix?
Upvotes: 0
Views: 280
Reputation: 5615
The rules you need are (in the root of the www domain). The root of the non-www domain doesn't need an .htaccess for this to work (but may later).
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
find out more: Generic htaccess redirect www to non-www
Once your client is back, hurry up, point www and non-www to the same hosting space, and decide which is prominent, google will not like if you have both www and non-www listed. Just the above rules or viceversa will do. Also keep in mind that by changing domains or breaking routing you could lose ranking.
Upvotes: 1