2011-11-04 92 views
0

我試圖URL重寫了兩個GET參數的URL,我想隱蔽頁:URL有兩個URL重寫參數

status/mystatus.php?=reference=1234&postcode=LL1+LL2 

分爲:

status/1234/LL1+LL2 

我已經使用了嘗試以下代碼:

RewriteRule ^status/([a-z0-9A-Z]+)/([a-z0-9A-Z]+)$ status/mystatus.php?reference=$1&postcode=$2 [NC,L] 

但它似乎並沒有工作,所以我做錯了什麼? (模塊開啓時,我使用的Apache)

+0

「打開模塊」後,你重新啓動Apache嗎? – Raptor

+0

這並不是真的在我的控制之下,但我知道它的工作原理是因爲它使用了不同的網址,就像我可以將詳細請求發送到details.php – Alex

+2

,因爲@ShivanRaptor提到確保「RewriteEngine On」位於.htaccess的頂部文件。 – hafichuk

回答

1

嘗試改變,括號內的表達式[^/]+所以它看起來像:

RewriteRule ^status/([^/]+)/([^/]+)$ status/mystatus.php?reference=$1&postcode=$2 [NC,L] 

因爲[a-z0-9A-Z]將不匹配的東西,如「+」。

1
RewriteRule ^status/(.*)/(.*)+(.*) 
+0

感謝您通過回答我的問題來幫助我。我正在爲你投票。這是我能爲你做的最多的事情:-) –