Skip to main content
3 of 3
edited title
posfan12
  • 716
  • 2
  • 7
  • 14

Deny access to all PHP files using FilesMatch, but make an exception for one file

Currently, using htaccess I am denying access to any PHP file in a directory, but not the JS, PNG, CSS files in the same directory.

<FilesMatch "\.php$">
Order deny,allow
Deny from all
</FilesMatch>

What if I want to make an exception for one file ("foobar.php" for example) however? Can I write multiple statements in a single htaccess? What is the order of execution?

posfan12
  • 716
  • 2
  • 7
  • 14