Force Users to use www.yourdomain.com not yourdomain.com. 0
If your having problems with cookies, and incoming links sometimes varying between www.example.com and example.com, which doesn’t help SEO.
Use this quick fix to solve your problem.
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [QSA,L,R=301]
It will forward your users keeping their path and query string.
Example: http://test.com/page.html?affiliate_id=1 is redirected to http://www.test.com/page.html?affiliate_id=1
The 301 code that is also sent ensures search engines understand that this redirect is permanent which helps your site keep and maximize its SEO ranking.
I hope this helps, as always, ask your questions in the comments.
subscribe to comments RSS
There are no comments for this post