Omeka install on Mountain Lion Server - mod_rewrite error fix

I just spent some time trying to install Omeka on OSX Mountain Lion Server, and wanted to share the experience in order to help someone encountering a similar issue.

After creating the DNS machine record and setting up the website in the Server App, I unzipped the Omeka files into the folder located in Library/Server/Web/Data/Sites/myfolder. However, when I tried to access the URL to the install folder in my browser, I got an mod_rewrite error message. I first tested whether mod_rewrite is enabled by creating a test PHP file with the following PHP code (placed in the Omeka root folder):

<?php if(in_array('mod_rewrite', apache_get_modules())) {echo "enabled";} else {echo "disabled";} ?>

After confirming that it was indeed enabled, I edited the .htaccess file, as was recommended in the forum, but still the error persisted.

After some more research I thought that most likely the error was a result of "AllowOverrides" being set to None in the Apache http_conf - which turned out to be indeed the case. To allow the overrides I first created a vhost file in /private/etc/apache2/other which theoretically would override the setting for that domain, but it did not fix the issue - somehow the vhost file appeared to get ignored.

Only then did I realize that for OSX Mountain Lion Server, unlike Mountain Lion, the httpd_conf settings which are set in /private/etc/apache2/ are being ignored by the server. Instead Apache uses the settings which are defined via the server app and are located in /Library/Server/Web/Config/apache2

To allow overrides for any particular website, these changes must be made directly using the server app. So go to the website in the server app and click on Advanced Edit - voila, there is a checkbox to "Allow overrides using .htaccess files".

Check, save, and restart the webserver and it should all work just fine. You may have to revert the .htaccess file back to the original.

Thanks so much for this write-up. I'm sure that it will help someone out there get things set up!