Drupal Rules

Topics: Developer Forum, User Forum
Mar 23, 2012 at 3:52 PM

Hi, thank you for the free software.

Just a note about Drupal.

I used rules found in file drupalrules.ini located in the ExampleIni folder and I discovered that this file have some problem with image cache. Drupal build an image preset when browser made a request and chached file not esist. In other word when a client do a request for an image www.mysite.com/q=sites/default/files/styles/medium/public/field/image/Audit_0.png, Drupal create the cached file sites/default/files/styles/medium/public/field/image/Audit_0.png if the file not exists.

So I realized that I should remove rules that bypass index.php on images and this is my final config i want share to help drupal users.


RewriteLog  E:\Inetpub\logs\iirfLog.out
RewriteLogLevel 1

# Do not pass to drupal if the file or directory exists
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [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]