hi I've been using this rewrite and it works fine but now I'm using a subdomain so things are getting redirected inappropriately, please advise how to have non www redirect to www., but excluding a specific subdomain RewriteEngine on RewriteCond %{HTTP_HOST} !^www\.domainname\.com$ [NC] RewriteRule ^(.*)$ http://www.domainname.com/$1 [R=301,L] Thank you
The following code will redirect the non www request coming to your main website to www of the main website. This won't affect the sub-domains.
Thanks for the suggestion but this results in the following message from http://subdomain. or http://www. Firefox has detected that the server is redirecting the request for this address in a way that will never complete. or Safari can’t open the page. Too many redirects occurred trying to open “http://www.domainname.com/â€. This might occur if you open a page that is redirected to open another page which then is redirected to open the original page. However http://domainname.com works. Thanks
Try this, Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^domain\.com RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]