Drupal Rules

May 10, 2007 at 8:59 PM
Edited May 10, 2007 at 9:16 PM
Here I share the Drupal rules I came with. Feel free to use them or to modify them.
RewriteLog  E:\temp\iirfLog.out
RewriteLogLevel 3
RewriteFilterPriority HIGH
 
# Accept a url with the following directories and pass them through unchanged.
RewriteRule ^/misc/(.*)$ /misc/$1 [I,L]
RewriteRule ^/files/(.*)$ /files/$1 [I,L]
RewriteRule ^/modules/(.*)$ /modules/$1 [I,L]
RewriteRule ^/themes/(.*)$ /themes/$1 [I,L]
RewriteRule ^/sites/(.*)$ /sites/$1 [I,L]
RewriteRule ^/uploads/(.*)$ /uploads/$1 [I,L]
RewriteRule ^/css/(.*)$ /css/$1 [I,L]
RewriteRule ^/images/(.*)$ /images/$1 [I,L]
 
# for modules that provide their own js (tinymce,img assist etc)
RewriteRule ^(.*\.js)$ $1 [I,L]
RewriteRule ^(.*\.gif)$ $1 [I,L]
RewriteRule ^(.*\.png)$ $1 [I,L]
RewriteRule ^/modules/tinymce/(.*)$ /modules/tinymce/$1 [I,L]
 
# Make URLs sane
RewriteRule ^/cron\.php$ /cron.php [I,L]
RewriteRule ^/index\.php\?q\=(.*)$ /index.php?q=$1 [I,L]
RewriteRule ^/update\.php\?op\=(.*)$ /update.php?op=$1 [I,L]
RewriteRule ^/update\.php /update.php [I,L]
RewriteRule ^/xmlrpc\.php /xmlrpc.php [I,L]
 
RewriteRule ^/robots\.txt /robots.txt [I,L]
 
# Handle query strings on the end
RewriteRule /(.*)\?(.*)$ /index.php\?q=$1&$2 [I,L]
 
# now pass through to the generic handler
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ /index.php?q=$1 [I,L]