htaccess mod_rewrite: Redirect all subdomains, exclude some
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.
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]
精彩评论