我想將所有請求重定向到index.php。mod_rewrite將所有請求重定向到index.php,包括目錄
如:localhost/abc/def
--->localhost/index.php?url=abc/def
這裏是我的.htaccess線:
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
但是我有一個問題,我有一個目錄 「測試」,當我去localhost/test
,我希望它重定向到locahost/index.php?url=test
,但地址欄顯示爲localhost/test/?url=test
。
如何刪除查詢字符串? (?url=test
或類似的東西,當我輸入地址訪問目錄)?
你試過:http://stackoverflow.com/questions/3800768/php-redirecting-all-pathes-to-a-certain- php文件? –