force all urls to www and force domain to non-www
- by Digital site
I was trying to force my domain to redirect without www and could success through this code:
.htaccess:
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule ^(.*) http://domain.com/$1 [R=301,L]
however, this code is going to redirect all www to non-www, which is not what I want. I just want to make the main domain from www.mydomain.com…