J
jamesyeeoc
Guest
Do not remove the *.domain.com DNS entry for the domain.
I prefer to do it slightly differently (not chaining them with the [OR]. It gives me more flexibility by having discreet sections for each subdomain for later changes.
For example:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteMap lowercase int:tolower
ServerAlias sub1.domain.com
RewriteCond %{HTTP_HOST} ^sub1.domain.com$
RewriteCond %{REQUEST_URI} !error_docs
RewriteRule ^/(.*) http://www.domain.com/$1 [L,R]
ServerAlias sub2.domain.com
RewriteCond %{HTTP_HOST} ^sub2.domain.com$
RewriteCond %{REQUEST_URI} !error_docs
RewriteRule ^/(.*) http://www.domain.com/$1 [L,R]
</IfModule>
This should redirect 'sub1.domain.com' and 'sub2.domain.com' to 'www.domain.com', and is easier to modify at a later date if needed.
I prefer to do it slightly differently (not chaining them with the [OR]. It gives me more flexibility by having discreet sections for each subdomain for later changes.
For example:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteMap lowercase int:tolower
ServerAlias sub1.domain.com
RewriteCond %{HTTP_HOST} ^sub1.domain.com$
RewriteCond %{REQUEST_URI} !error_docs
RewriteRule ^/(.*) http://www.domain.com/$1 [L,R]
ServerAlias sub2.domain.com
RewriteCond %{HTTP_HOST} ^sub2.domain.com$
RewriteCond %{REQUEST_URI} !error_docs
RewriteRule ^/(.*) http://www.domain.com/$1 [L,R]
</IfModule>
This should redirect 'sub1.domain.com' and 'sub2.domain.com' to 'www.domain.com', and is easier to modify at a later date if needed.