I am currently running Apache2 on my local machine, installed with the latest version of Ubuntu.
I am trying to get basic URL rewriting working by using the .htacces
For the benefit of others, I figured out the answer:
In the file "/etc/apache2/sites-enabled/000-default" there was the line:
AllowOverride None
Change this to:
AllowOverride All
You need to remove the contextual path prefix from your pattern when using mod_rewrite in a .htaccess file. In the case of the root directory, the path prefix is just /
. So try this:
RewriteRule ^doesnotexist/(.*)$ /page.php?p=$1
If I place a .htaccess into /Library/WebServer/Documents and open "localhost/"; to test it, this works as expected. It just doesn't work in "~/Sites". I have tried this on Mac OS X Mavericks.