Reputation: 913
I'm looking for a htaccess code to redirect my url's like this :
http://01.mydomain.com/subdir/xyz [OR]
http://www.01.mydomain.com/subdir/xyz [OR]
http://02.mydomain.com/subdir/xyz [OR]
http://www.02.mydomain.com/subdir/xyz
TO : http://www .mydomain.com/xyz
and in this case xyz
is dynamic and could be any value. and subdir
is constant
Upvotes: 0
Views: 4959
Reputation: 72961
Assuming subdir
is constant, the following is one way:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^01.mydomain.com [OR]
RewriteCond %{HTTP_HOST} ^www.01.mydomain.com [OR]
RewriteCond %{HTTP_HOST} ^02.mydomain.com [OR]
RewriteCond %{HTTP_HOST} ^www.02.mydomain.com
RewriteRule ^subdir/(.*)$ http://www.mydomain.com/$1 [L,R=301]
Upvotes: 2