首先,我想展示一个完整的工作示例,它几乎满足了我的要求:
. htaccess
RewriteEngine On
RewriteRule ^index.php/(.*)$ index.php?title=$1
index . php
echo 'title = '.$_GET['title'];
请求localhost/php/htaccess2/index . php/测试
RESULT title = test
现在我希望它工作通过请求localhost/php/htaccess2/test
所以我把。htaccess改成了RewriteEngine On
RewriteRule (.*) index.php?title=$1
然后返回
RESULT title = index.php
我想让它返回title = test请帮帮我!
我用另一个旗帜如QSA解决了它http://httpd.apache.org/docs/current/rewrite/flags.html
你试过了吗?
RewriteRule (.*) index.php?title=$1 [NC]
:
RewriteRule ^(.*)$ index.php?title=$1 [PT,L]