My Drupal Rewrite Rules

I have Drupal 4.7.3 on my Lighttpd server and it requires some rewrite rules for Clean URL’s. I found an example in the forums ( and adapted it for my use. The only problem I’ve noticed is that the option for Private downloads through Drupal does not work. Public downloading still works, and I’m not sure why. I might have a mistake somewhere. Drupal is in its own subdirectory called (surprisingly) drupal.

Oh, and fastcgi definitely does not work with Windows, lighttpd, and php, at least for now. A new version was just released but I don’t believe that has been fixed yet.

#for Drupal, found at # Clean URL
#server.modules += ( “mod_rewrite” )

url.rewrite-final = (
# Clean URL test for 4.6
“^/drupal/system/test/(.*)$” => “/drupal/index.php?q=system/test/$1”,

# Clean URL test for 4.7
“^/drupal/system/test-clean-url/(.*)$” => “/drupal/index.php?q=system/test-clean-url/$1”,

# feed alias
“/drupal/rss.xml$” => “/drupal/index.php?q=rss.xml”,

# Search
“^/drupal/search/(.*)$” => “/drupal/index.php?q=search/$1”,

# More than one argument
“^/drupal/([^.?]*)\?(.*)$” => “/drupal/index.php?q=$1&$2”,

# No arguments
“^/drupal/([^.?]*)$” => “/drupal/index.php?q=$1”,

#to download attachments via private downloads, but doesn’t seem to work. Something missing?
“^/drupal/system/files/(.*)$” => “/drupal/index.php?q=system/files/$1″

# Exempt .html suffixes. Uncomment this if you have your path aliases end in .html
#”^/([^.?]*\.html)$” => “/index.php?q=$1”


#There is also a suggested deny rule to go along with the rewrite rules.

url.access-deny = ( “~”, “.inc”, “.engine”, “.install”, “.module”, “.sh”, “sql”, “.theme”, “.tpl.php”, “.xtmpl”, “Entries”, “Repository”, “Root” )


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s