php - Apache rewrite - clean URLs in localhost -
i have been trying past few hours write clean urls in lamp machine.
apache's mod_rewrite enabled, , trying use .htaccess file pass url parameters index.php script @ time var_dump of _get.
my current .htaccess following (although i've tried quite few variations of found on other answers no success)
rewriteengine on #make sure it's not actual file rewritecond %{request_filename} !-f #make sure not directory rewritecond %{request_filename} !-d #rewrite request index.php rewriterule ^(.*)$ index.php?/get=$1 [l]
when point browser localhost/my_project/test, 404 error saying:
not found
the requested url /my_project/test not found on server.
apache/2.2.22 (ubuntu) server @ localhost port 80
apparently i'm missing obvious here, help?
2 things for:
- make sure .htaccess enabled
- make sure above code in
my_project
directory.
then add rewritebase
line well:
rewriteengine on rewritebase /my_project/ #make sure it's not actual file rewritecond %{request_filename} !-f #make sure not directory rewritecond %{request_filename} !-d #rewrite request index.php rewriterule ^(.*)$ index.php?get=$1 [l]
Comments
Post a Comment