1
我試圖重寫URL,例如:GET變量
example.com/var?id=0&blah=foo
到
example.com/?test=var&id=0&blah=foo
到目前爲止,我有這在我的.htaccess:
AddHandler application/x-httpd-php5s .php
RewriteEngine on
RewriteRule ^([A-Za-z0-9-]+)/?$ ?api_call=$1 [L,QSA]
將var
重寫爲?test=var
,但剩餘的get變量將被忽略。
如何更改它以包含其他GET變量?
你的規則看起來不錯。你還有其他規則嗎? – anubhava
@anubhava這是唯一的一個。 – iRector
好的測試請試試這個:'RewriteRule ^([A-Za-z0-9 - ] +)/?$?test = $ 1 [L,QSA,R]' – anubhava