homemod_rewritephpos 9Impressum

mod_rewrite on OS X

I did use .htaccess to configure mod_rewrite. Therefore you have to configure the necessary rights in apaches configuration file (httpd.conf).
I applied the following changes to the httpd.conf file:
#
# If you prefer a single logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "/private/var/log/httpd/access_log" combined

RewriteEngine on
RewriteLog "/var/log/httpd/rewrite_log"
RewriteLogLevel 9


# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride All
As second step you put the .htaccess file in the "site root". All subsequent folders will have the same rules. For example my Document root for apache is /Library/WebServer/Documents/ an the "site root" /Library/WebServer/Documents/mySite/www. My .htaccess then looks like this:
#
# mod_rewrite
#

AddType application/x-httpd-php .inc

RewriteEngine on
RewriteBase /mySite/www/


# navigation item "Home"
RewriteRule ^(home)$ index.php
After all the site was still not working properly. Check the log file to see what happens. I did find out, that there where two absolute paths in the site which could not be translated properly.
As a refference you may have a look at http://www.engelschall.com/pw/apache/rewriteguide/>