Cannot get mod_rewrite to work on Mac OSX Mountain Lion

Posted by Joel Joel Binks on Server Fault See other posts from Server Fault or by Joel Joel Binks
Published on 2012-12-05T06:32:51Z Indexed on 2012/12/07 5:08 UTC
Read the original article Hit count: 445

Filed under:
|
|
|

I have tried everything I can think of and it still doesn't work. I am trying to get the example code from Larry Ullman's Advanced PHP book to work. His instructions were a bit lacking so I had to do some research. Here is what I have configured:

username.conf

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

httpd.conf

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

DocumentRoot "/Users/me/Sites"

<Directory />
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>


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

.htaccess

<IfModule mod_rewrite.so>

RewriteEngine on
RewriteBase /phplearning/ADVANCED/ch02/

# Redirect certain paths to index.php:
RewriteRule ^(about|contact|this|that|search)/?$ index.php?p=$1

RewriteLog "/var/log/apache/rewrite.log" 
RewriteLogLevel 2
</IfModule>

Nothing has worked and it won't even log to the rewrite.log file. What have I done wrong? FYI even when I set up an extremely simple rule or use the root as the rewrite base, it still fails. I have also verified the mod_rewrite module is running. I am really angry.

© Server Fault or respective owner

Related posts about apache2

Related posts about php