I have this rule for rewriting all subdomains to some URL, but I would like to edit it to rewrite all subdomains except subdomain "m".
RewriteCond %{HTTP_HOST} ^(.*)\.myweb\.cz
RewriteRule ^(.*)$ http://myweb.cz/adverts/%1/$1 [L,NC,QSA,R=301]
Thanks everyone.
答案 0 :(得分:0)
Try this htaccess
RewriteCond %{HTTP_HOST} !^m\.myweb\.cz$ [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.myweb\.cz$
RewriteRule ^(.*)$ http://myweb.cz/adverts/%1/$1 [L,NC,QSA,R=301]
答案 1 :(得分:0)
You can add a negative lookahead in your condition to avoid matching m.
:
RewriteCond %{HTTP_HOST} ^((?!m\.)[^.]+)\.myweb\.cz$ [NC]
RewriteRule ^(.*)$ http://myweb.cz/adverts/%1/$1 [L,R=301]