2010-07-11 84 views
0

我重寫URL像下面htaccess的問題未找到404

RewriteCond %{HTTP_HOST} ^subdomain\.mydomain\.example$ 
RewriteRule (.*) /subdomain/$1 [L] 

RewriteRule ^a/(.*)/(.*)$ search.php?searchtext=$1&locationtext=$2 [NC] 

我想打電話給我的網頁像

http://kolkata.mydomain.example/a/phptraining/Kolkata 

但是,當頁面被打開,這是說找不到404。我不理解這個錯誤。

+0

什麼是你希望它重寫? – 2010-07-11 12:58:05

回答

0

通過此規則集,只有第一條規則可能適用,但不適用第二條規則。嘗試不大號標誌中的第一規則,並考慮請求路徑中的一個子域可能:

RewriteCond %{HTTP_HOST} ^subdomain\.mydomain\.example$ 
RewriteRule .* /subdomain/$0 
RewriteRule ^([^/]+/)?a/([^/]+)/([^/]+)$ $1search.php?searchtext=$2&locationtext=$3 [NC] 
+0

這對3個參數運行良好怎麼樣? – 2010-07-11 13:02:55