我對PHP和RewriteRules相當陌生,我試圖讓localhost/webapp/sign_up.php指向localhost/webapp/sign_up。這是我的.htaccess代碼:.htaccess RewriteRule在我的本地主機上不工作
RewriteEngine On
RewriteRule ^sign_up/?$ sign_up.php
,但是當我去到localhost/web應用/ sign_up它說:
Not Found
The requested URL /webapp/sign_up was not found on this server.
我使用的Apache2(Ubuntu的)的方式,我相信rewrite_mod是啓用。
萬一有幫助,我的.htaccess是下無功/ www/html等/ webapp的
你爲什麼確定rewrite_mod已啓用?你重新啓動apache? – Martin
是的,我做到了。當我在終端上運行命令a2enmode rewrite時,它會顯示「模塊重寫已啓用」。是的,我開始apache2,但它仍然無法正常工作。這是404 Not Found錯誤。 – Alaa