Drupal Clean URLs – Part Two


In my last post, I talked about my experience setting up Drupal Clean URLs.  I had a very minor problem, which basically resulted in me having to add the correct .htaccess file to the root directory of my drupal installation.  Feel free to go back and read the last post for all the details.

The reason I’m posting again on this topic is because I found out there was a problem with my setup.  I have other folders which don’t contain drupal content in my root directory.  Well, these folders (which house other websites that I develop) were not functioning properly.  Basically, the content was showing up, but it wasn’t displaying properly.  The index.html page inside of these folders was showing up as a list of items but nothing else was displaying properly.  I found this to be strange behavior and when I checked all the other sites they were exhibiting the same behavior.

The only recent change I had made was to the .htaccess file in the root of site.  So I removed the .htaccess file and everything worked fine for my other websites housed in subfolders; but my drupal clean urls were of course no longer working properly…bummer!

I researched around the drupal website and I found the following helpful links in regards to .htaccess setup:

http://drupal.org/node/167169

http://drupal.org/node/30334

Of course, none of those suggestions worked for me.  After reading all the stuff I could find on the topic, I began looking deeper into the default drupal .htaccess file.  After looking at this particular section:

# Set the default handler.
DirectoryIndex index.php

I noticed that it seemed kind of odd.  The drupal .htaccess file is telling apache to only look for index.php files within directories.  Well, of course I had regular html content in those other directories and it wasn’t displaying properly.  I added index.html to this line as follows:

# Set the default handler.
DirectoryIndex index.php index.html

Uploaded to the server…PRESTO! Everything worked fine!  All my content in subdirectories is working without any problems and this is the only change that I made to the defualt drupal .htaccess file.

Here are my drupal install details:

drupal version: 6.4

.htaccess version: # $Id: .htaccess,v 1.97 2008/11/22 13:46:11 dries Exp $

PS: when installing drupal don’t forget to copy over the hidden .htaccess file that comes with all the other drupal files.  Also, if you already have a custom .htaccess file; back it up first in case you have problems!