I am trying to get .htaccess to work in my localhost (I've got Mac OS X 10.5). I enabled .htaccess by following articles like this one. But although now the rewriting is taking place, it is not working correctly. As an example, one of the rewrite rules is:
RewriteRule ^(home|faq|about|contact)$ index.php?section=$1 [QSA,NC]
So when I enter http://localhost/~MyUsername/MyWebsite/home
, I should be shown http://localhost/~MyUsername/Mywebsite/index.php?section=home
...but instead, a 404 error occurs, and the error message is "The requested URL /Users/MyUsername/Sites/MyWebsite/index.php was not found on this server."
My guess is that something in my Apache configuration is wrong (the rewrite rule works fine in my online host), but how to solve it is beyond my knowledge. Any ideas? Thanks in advance.
/Users/MyUsername/Sites/MyWebsite/index.php
exist? – Rob~MyUsername/...
kind of path. Ideally to access your homepage you should be just typinghttp://localhost/
(or very similar) and that's it (no/~MyUsername/MyWebsite/
part). This makes URL rewriting much more difficult (especially when user's home folder is involved). – LazyOne/Users/
folder. – LazyOne