regex - htaccess Rewrite rule picking up subdomain when it should not -


i've switched hosts, , using below rule force www. root site in /public_html/

# rewritecond %{http_host} !^www\.rootdomain\.com$ # rewriterule (.*) http://www.rootdomain.com/$1 [r=301,l] 

it worked fine, despite fact had:

public_html/otherdomain.com (has it's own htaccess) public_html/otherdomain2.com (doesn't have it's own htaccess) 

in new host, have same setup add on domains. when go to:

otherdomain.com - works fine.

when go to:

otherdomain2.com redirects rootdomain.com/otherdomain2.com

trial , error shows it's rewrite rule above.

to avoid matching subdomain use rule:

rewritecond %{http_host} ^rootdomain\.com$ [nc] rewriterule (.*) http://www.%{http_host}/$1 [r=301,l] 

Comments