I'm trying to find the most performance friendly way of denying access to specific files and folders via htaccess. (For example a .git folder, an .hg folder, the .htaccess file itself.) Is there some particlaur method, or combination, that is more performance friendly than the others? (FilesMatch vs DirectoryMatch vs RedirectMatch vs whatever.)

link|improve this question
feedback

1 Answer

In an .htaccess file, the performance difference between any of those is negligible. They all do filesystem stat calls, which is the "expensive" part.

For the best performance, if you can, use LocationMatch directly in the VirtualHost of your Apache httpd configuration.

link|improve this answer
The httpd file is out of the question. Even negligible gains or losses are important here. – Joshua Walker Jul 26 '11 at 17:58
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.