2014-01-18 100 views
1

我試圖讓子域使用htaccess的我的網站的工作,例如:子域MOD-重寫問題內部重定向不起作用

shopping.site.local應該引導用戶去site.local /購物的並且保持初始子域格式的方式,意味着在用戶不能注意到的內部重定向中。

我已經添加下面的腳本:

RewriteCond %{HTTP_HOST} ^shopping.site.local$ [OR] 
RewriteCond %{HTTP_HOST} ^www.shopping.site.local$ 
RewriteRule ^(.*)$ http://www.site.local/shopping-and-fashion/$1 [L] 

重定向發生成功,但在外部的方式,如何隱藏重定向到所要的網址:

http://shopping.site.local

和內容:

http://www.site.local/shopping-and-fashion

回答

0

你試過用[P]代替[L]嗎?

+0

是的,給了我一個錯誤! ;) –

0

下使用反向代理,應該給你想要的

<VirtualHost *:80> 
    ServerName shopping.site.local 
    ProxyPass/http://www.site.local/shopping-and-fashion/ nocanon 
    ProxyPassReverse/http://www.site.local/shopping-and-fashion/ 
</VirtualHost> 

您可能需要破解一些JS和CSS,以適應如果原始文件不友善相對鏈接的路徑改變什麼。