Apache mod_rewrite not working properly on Mac OS X 10.6 (Snow Leopard)

apache-2.2mac-osxmod-rewrite

I'm trying to create a PHP website with clean URLs with Apache's mod_rewrite, using a .htaccess file. mod_rewrite seems to be working, however, it claims it cannot find files on my server that do exist.

Just as a basic test, this is what my .htaccess file looks like at the moment–going to [mysite]/page should redirect to the index.php file:

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^page$ index.php

Afaik, I have setup the .conf file appropriately as well:

<Directory "/Users/myuser/Sites/">
    Options Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

However, when I try accessing the URL setup via mod_rewrite ( localhost/~myuser/mysite/page ), I get this:

Not Found

The requested URL /Users/myuser/Sites/mysite/index.php was not found on this server.

However, that file does exist, and that is the proper location! The site works fine otherwise, if I go to localhost/~myuser/mysite/index.php, everything works fine–minus any sort of clean URLs, of course.

Has anyone seen this before/have any ideas as to what I'm doing wrong?

Best Answer

You'll need RewriteBase if you're in your userdir and substituting to a relative path.

Related Topic