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.

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.)

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|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
    
But regardless, thank you for posting an answer. –  Joshua Walker Aug 23 '12 at 19:19
add comment

Your Answer

 
discard

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

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