Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Joel,

Hi - just came up against the same problem. Saw this post:

http://apple.stackexchange.com/questions/47526/enable-url-rewriting-mod-rewrite-using-htaccess-files-in-sites-on-lion

and changed my username.conf file from

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

to

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

and now mod_rewrite is working for me.

share|improve this answer
    
It was also a stupid mistake I made where I used the example from the book, which is for Windows, not Mac. Windows has a special tag that breaks the file in Unix. Arrrrgh. –  Joel Joel Binks Dec 7 '12 at 18:35
    
I am referring to .htaccess in this case. Windows handles things differently. –  Joel Joel Binks Dec 7 '12 at 18:36
add comment

Your Answer

 
discard

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.