Reputation: 1053
There are many similar questions, but I couldn't find an answer to this specific one:
In my .htaccess I have a rewrite to redirect all subdomains to http://example.com:
RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
But I want it to ignore dev.example.com (and maybe some other subdomains). I guess that's easy, but I can't figure it out.
Upvotes: 2
Views: 7105
Reputation: 33904
Same way as you excluded the main domain:
RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteCond %{HTTP_HOST} !^dev\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
Upvotes: 9