Skip To Bottom


Enabling Mod_Rewrite In Mac OS 10.5 & 10.6

Apache’s mod_rewrite functionality allows you to redirect and rewrite your web site URLs, providing a developer with an easy way of creating human readable, well structured and, most importantly, navigable page addresses. It’s used by almost all Apache-based software from Wordpress to Codeigniter. Enabling it within Apple’s latest iteration of Mac OS X is, unfortunately, a bit of a fiddle.

Updating the Apache configuration to allow the use of this functionality is achieved by modifying two files, one for the global web-server directory and one for your local web-server directory, (the much easier-to-access ~/Sites folder). The first file to be modified is the global configuration file, and it needs to be modified around line 205.

/private/etc/apache2/httpd.conf

  1. # AllowOverride controls what directives may be placed in .htaccess files.
  2. # It can be "All", "None", or any combination of the keywords:
  3. # Options FileInfo AuthConfig Limit
  4. AllowOverride All

The second file, allowing you to use mod_rewrite within your own ~/Sites folder, is the one that seems to break Apache on a more regular basis. The values below, located at the top of the file, yielded the best results, enabling the functionality without causing server errors.

/private/etc/apache2/users/username.conf

  1. <Directory "/Users/beseku/Sites/">
  2.     Options Indexes FollowSymLinks MultiViews
  3.     AllowOverride All AuthConfig
  4.     Order allow,deny
  5.     Allow from all
  6. </Directory>

After making and saving these changes, you’ll need to restart Apache, (easily done via the ‘Sharing’ system preference pane, just un-check then re-check the ‘Web Sharing’ checkbox). If everything went well, Apache should start up again and you should have full mod_rewrite functionality.



Skip To Top