简体   繁体   English

使用htaccess重定向除一个以外的所有子域

[英]Using htaccess to redirect all subdomains except one

current htaccess: 当前的htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mywebsite.co.uk [NC]
RewriteRule ^(.*)$ http://www.mywebsite.co.uk/$1 [L,R=301,NC]

I also have a subdomain : m.mywebsite.co.uk I don't want this "m." 我也有一个子域:m.mywebsite.co.uk我不要这个“ m”。 domain redirected, but all other subdomains that exist or not directed to www.mywebsite.co.uk including "mywebsite.co.uk" 域名被重定向,但是存在或不指向www.mywebsite.co.uk的所有其他子域,包括“ mywebsite.co.uk”

Can you help? 你能帮我吗? thanks 谢谢

Try : 尝试:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^m\.mywebsite\.co\.uk$
RewriteCond %{HTTP_HOST} !^www\.mywebsite\.co\.uk$ [NC]
RewriteRule ^(.*)$ http://www.mywebsite.co.uk/$1 [L,R=301,NC]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM