0
我正在嘗試使用PHP mod_rewrite來更改某些URL。重寫規則不按預期行爲
作爲測試,在我的.htaccess我有以下幾點:
RewriteEngine on
RewriteRule ^(.*[^/])$ index.php?test=$1
#RewriteRule ^([^/]+)/$ index.php?test=$1
在我的index.php文件中我只是
<?php print_r($_GET) ?>
我想發生的是,當任mysite.com/test或mysite.com/test/在瀏覽器地址欄中,PHP $ _GET ['test']變量的值爲'test'。
的註釋行正常工作與mysite.com/test/但似乎什麼都不做與mysite.com/test
第二線(註釋掉的)結果爲「的index.php」的值$ _GET ['test']在瀏覽mysite.com/test時不做任何事情,並且不會用mysite.com/test/做任何事情
有沒有什麼我在這裏忽略,可以讓我得到想要的結果?
感謝
非常感謝。快速測試可以獲得我需要的結果。 – Douglas 2010-11-02 15:27:52