Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

For my Drupal site's .htaccess I've this rule:

  # Pass all requests not referring directly to files in the filesystem to
  # index.php. Clean URLs are handled in drupal_environment_initialize().
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]

I've added another rule to bypass Drupal(or index.php) for file not founds and let Apache directly show error(which is working):

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4|dll|css|js|cgi)$">
ErrorDocument 404 default

My query is that in case of any non-existing files it is handled by the above RewriteRule which invokes index.php . Then how FilesMatch directive is working for file not founds( since index.php should have already been called)?

In other words, FileMatch directive should not have been called since it's matching case is taken care already by above RewriteRule.

enter image description here

share|improve this question

migrated from webmasters.stackexchange.com Sep 23 '13 at 14:28

This question came from our site for pro webmasters.

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.