2011-05-28 140 views
0

如何將示例網址轉換爲所需的網址?子域名htaccess

From 

http://test.at.domain.com 

To 

http://domain.com/at/index.php?id=test 

回答

1
RewriteEngine on 
RewriteCond %{HTTP_HOST} (\w+).at.domain.com [NC] 
RewriteRule .* http://domain.com/at/index.php?id=%1 [L] 
+0

不起作用。它說抱歉,這個網站目前不可用 – luis 2011-05-28 05:17:11

+0

它試圖將您的網址發送到哪個網址?這是你期望的URL嗎?如果這是您所期望的,那麼問題不在於.htaccess文件,而是您的網站。如果這不符合你的期望,那麼你期望的是什麼?您還需要說出您期望%1做什麼。 – Trott 2011-05-28 05:18:20

+0

我誠實地不知道如何使用這種類型的正則表達式我試圖從另一個例子中派生它。即時猜測%1是{http_host}與更改後,但不知道 – luis 2011-05-28 05:19:45