Redirecting domain without redirecting subdomains
Hiya,
First off thank you for your support pages they've helped us out a lot over the years!
We'd like to redirect our domain (we've got a non www to www redirect in place) but not redirect the subdomains so they'll still be found. This is what we have for our basic non www to www redirect:
# Redirect non www to www site
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
And so far to redirect the domain but not the subdomains I've got this:
# Redirect www site excluding subdomains
RewriteCond %{HTTP_HOST} !^(subdomain1|subdomain2|subdomain3|)\.website\.com$ [NC]
RewriteRule ^(.*)$ http://www.website.com$1 [L,R=301]
I'd like your opinion as to whether or not a.) that code will work and b.) if that's actually the best way to do this.
Thank you!
First off thank you for your support pages they've helped us out a lot over the years!
We'd like to redirect our domain (we've got a non www to www redirect in place) but not redirect the subdomains so they'll still be found. This is what we have for our basic non www to www redirect:
# Redirect non www to www site
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
And so far to redirect the domain but not the subdomains I've got this:
# Redirect www site excluding subdomains
RewriteCond %{HTTP_HOST} !^(subdomain1|subdomain2|subdomain3|)\.website\.com$ [NC]
RewriteRule ^(.*)$ http://www.website.com$1 [L,R=301]
I'd like your opinion as to whether or not a.) that code will work and b.) if that's actually the best way to do this.
Thank you!