1
我有以下的htaccess正在工作:如何獲取域名形式的子域名的htaccess?
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(?!www\.)([^.]+)\.([^.]+)\.([^.]+)$ [NC]
RewriteRule^%1%{REQUEST_URI} [L]
我有4個域名指向同一服務器(domain.com)
example1.com
example2.com
example3.com
example4.com
眼下實際htaccess的,當我去
test.example1.com
它將從目錄顯示文件
domain.com/test
只是我想要它。
但我需要實現一個新功能。
所以,當我去
test.example1.com
它需要去
domain.com/example1.com/test
和同樣以
test2.example1.com ----> domain.com/example1.com/test2
test5.example2.com ----> domain.com/example2.com/test5
test6.example3.com ----> domain.com/example3.com/test6
test9.example4.com ----> domain.com/example4.com/test9
它將不會重定向,它重寫,我不不希望重定向。
'它將不會重定向,它重寫,我不希望它redirect'你能澄清這一說法? –
當然,假設我訪問了test2.example1.com,它不應該重定向到domain.com/example1.com/test2,它應該只顯示無法重定向的內容。 –
你有太多的例子。你有多個子域名,你想重寫爲一個子域名的主域名? –