2013-01-22 34 views
0

我試圖得到這個,但我真的不知道爲什麼不行。我試圖改變的東西,而params,將無法正常工作:爲什麼帶有1個變量的.htaccess不起作用?

RewriteCond %{QUERY_STRING} board=([0-9]+).0 
RewriteRule ^forum/index\.php$ index.php?option=/$1? [R=301,L] 

url: 
www.abc.com/forum/index.php?board=13.0 
+0

是$ 1之前需要的正斜槓嗎? –

+0

將無法​​工作 – Motheus

+0

在RewriteCond中,可能會在.0之前加\ \ – Mikolaj

回答

1

應該是這樣的:

RewriteCond %{QUERY_STRING} board=([0-9]+)\.0 
RewriteRule ^(forum/index\.php)/?$ index.php?option=/$1? [R=301,L] 

這樣,後面引用$ 1的正則表達式得到集團內部()

相應地修改圓括號內的內容。

UPDATE

RewriteCond %{QUERY_STRING} board=([0-9]+)\.0 
RewriteRule ^forum/index\.php/?$ index.php?option=/%1? [R=301,L] 

返回參考%1獲得該組中以前的狀態的正則表達式(董事會值)。

+0

似乎也不起作用。仍然沒有得到我的參數板:( – Motheus

+0

我不想傳遞路徑,只是板變量 – Motheus

+0

哦wtf我忘了%1 – Motheus

相關問題