1
我需要此腳本來重寫例如「website.com/index.php?id=1/」到「website.com/1」的網址,但我無法讓它工作。爲什麼不用這個代碼工作,我能做些什麼來使它工作?htaccess將不會重寫正確
輸入:http://example.com/index.php?id=1 輸出:http://example.com/-?id=1
RewriteEngine On
RewriteRule ^index\.php - [L]
RewriteCond ${REQUEST_FILENAME} !-d
RewriteCond ${REQUEST_FILENAME} !-f
RewriteCond ${REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ /index.php?id=$1 [QSA,L]
然後,它顯示的網站的根目錄:htaccess的文件應該/將位於與其餘網站文件,對吧? – user2925329
這是假設.htaccess是在網站的文檔根。你在哪個文件夾中保存了它?對於URL,你會遇到問題嗎? – anubhava