Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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?

share|improve this question
What does your Apache ErrorLog say? And when you turn on RewriteLog, does it show you what you think it should? – larsks Jan 22 '11 at 3:29
up vote 2 down vote accepted

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

share|improve this answer
Read the docs for RewriteBase and turned out to be exactly what I needed--thanks! – DashRantic Jan 22 '11 at 21:29

You have to add FollowSymlinks after Multiviews. I wrote a tutorial for the whole thing here:

Hope that solves your problem. Cheers! :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.