# Access Forbidden on Omeka Themes Directory

This has bitten me twice now so I’m (finally) documenting it.

The situation arises when an Omeka site that’s working fine on a CentOS box is moved to an Ubuntu box. Everything will work fine except for viewing the site’s themes from within the administrative interface. When /admin/themes is accessed, the user is greeted with a “Directory access is forbidden” message.

It’s not a mod_rewrite issue (as one might first expect) because every other aspect of the site works fine.

The problem is that Ubuntu’s Apache configuration default has index.html as one of the DirectoryIndex values. This seems like a reasonable default, but it causes problems with Omeka’s rewriting rules in the site’s .htaccess file:

RewriteCond %{REQUEST_FILENAME} !-f


When index.html is a DirectoryIndex value in the Apache configuration, Apache will check /admin/themes/index.html and find a file there. That file is intended to be the fallback for the PHP script, but Apache bypasses the PHP because the RewriteCond tells it to skip the rewrite when a file is found. So, what can be done? Tweaking the .htaccess file won’t do you any good.

What needs to be done is to reconfigure the DirectoryIndex value for Apache in the virtual host configuration for your Omeka site. So, the new virtual host configuration might look like:

<VirtualHost *:80>
ServerName omeka
DocumentRoot /var/www/omeka

LogLevel info

ErrorLog ${APACHE_LOG_DIR}/omeka-error.log CustomLog${APACHE_LOG_DIR}/omeka-access.log combined

<Location />
DirectoryIndex index.php
Order deny,allow
Allow from all
</Location>
</VirtualHost>


By telling Apache to only look for an index.php file and not for an index.html file, the rewriting in the .htaccess file will work and Omeka will redirect the user to the index.html file only when it’s absolutely necessary. Once this is changed, the /admin/themes URL will work again. Hooray!