我有一個URL重寫規則幫助
http://test.devsite-1.com/test/tbox/
,我想重定向到
http://tbox.devsite-1.com/
規則:
RewriteCond %{HTTP_HOST} !^tbox\.(.*)$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.|)(.*)$ [NC]
RewriteCond %{REQUEST_URI} ^/tbox(/.*|)$
RewriteRule /tbox/(.*) http://tbox.%{HTTP_HOST}/$1 [R=301,L]
我不明白爲什麼它不重定向我網址?請注意我需要一個通用規則,因此如果我將test.devsite-1.com
更改爲tempo.devsite-1.com
,則同樣應該與其他網址一起使用。
已修改RewriteRule(。*)http://tbox.% {HTTP_HOST}/$ 1 [R = 301,L] ....這些都是我無法得到的問題... – user269867
If request通過'test.devsite-1.com'然後'tbox.%{HTTP_HOST}'會生成'tbox.test.devsite-1.com' - 這顯然是錯誤的('%{HTTP_HOST}'包含完整的域NAME,不只是'devsite-1.com')。 – LazyOne