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