Forum Moderators: phranque
to always go to this url:
[mydomain.com...]
The below lines in my .htaccess and handle all of the above except when a person actually types out [leaders.mydomain.com....] I'm very new to the syntax and have groped my way to this point by borrowing from other examples, etc.
RewriteCond %{HTTP_HOST} ^leaders.mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.leaders.mydomain.com$
RewriteRule ^(.*)$ [mydomain.com...] [R=301,L]
# You'll need this anyway
RewriteEngine On
# This will match on both leaders.mydomain.com and www.leaders.mydomain.com.
# Note that the closing anchor ($) is removed to make sure it will match even
# if the port number is defined in the request (then it becomes
# leaders.mydomain.com:80 for example.
RewriteCond %{HTTP_HOST} ^(www\.)?leaders\.mydomain\.com
# here I removed the brackets, which is used for grouping or capturing
# back-references, but you don't need any of them
RewriteRule .* [mydomain.com...] [R=301,L]
That's it.