[英]Redirect subdomain with www. Code without www is working (Wildcard)
現在,我在.htaccess重定向( 通配符打開 )中有很多子域到其他域的規則。
例如:subdomain123.domain.com-> other-domain.co.uk/subdomain123
但使用www重定向不起作用。 例如: www。** subdomain123.domain.com-> other-domain.co.uk/subdomain123-** 404錯誤 -請與www幫助。
RewriteCond %{http_host} .
RewriteCond %{http_host} !^domain.com [NC]
RewriteCond %{http_host} ^([^.]+)\.domain.com [NC]
RewriteRule ^(.*) http://other-domain.co.uk/%1 [R=301,L,QSA]
嘗試更改條件以有選擇地匹配“ www”:
RewriteCond %{http_host} .
RewriteCond %{http_host} !^domain.com [NC]
RewriteCond %{http_host} ^(www\.)?([^.]+)\.domain.com [NC]
RewriteRule ^(.*) http://other-domain.co.uk/%2 [R=301,L,QSA]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.