我需要幫助(內部重定向?)使用Apache的htaccess。htaccess:子域到服務器上的文件夾。保持URL
在我的服務器我有一個主域:
網址:domain.com
服務器的路徑:/opt/public_html/domain.com/
和子域:
url:sub.domain.com
服務器的路徑:/opt/public_html/sub.domain.com/
當訪問者類型sub.domain.com
我想要的網址將保持不變。我還希望服務器向訪問者提供文件/opt/public_html/domain.com/index.php
。我如何在.htaccess中做到這一點?
另外,如果訪問者輸入sub.domain.com/sofa/
,則服務器應該在不更改URL的情況下爲文件/opt/public_html/domain.com/sofa/index.php
提供服務。
Got it? OK最後一個例子:
如果訪問者類型sub.domain.com/?big=mac
服務器應該顯示文件/opt/public_html/domain.com/?big=mac
而不更改URL。
任何想法如何做到這一點?
對不起?所以訪問'http:// sub.domain.com'會轉到'/ public_html/sub.domain.com /',而'http:// sub.domain.com/sofa'會轉到'/public_html/domain.com /沙發/ index.php'?這很奇怪! –
否。如果'http:// sub.domain.com'則是'/ public_html/domain.com /',如果是'http:// sub.domain.com/sofa',那麼'/public_html/domain.com/sofa/index.php'(或'/ public_html/domain.com/sofa /'無關緊要) – Ralle
但是在你的問題中你沒有這樣說? –