How to allow only certain files in Apache
-
I'd like to filter access to certain files in apache. I want only CGI access. So I tried putting in vhost file: <FilesMatch "\.cgi$"> Order allow,deny Allow from all </FilesMatch> <FilesMatch "."> # All other files Order allow,deny Deny from all </FilesMatch> But the latter overrides it all. Thanks
-
Answer:
I believe you need to swap the values in your Order directive as follows: <FilesMatch "\.cgi$"> Order Deny,Allow Allow from all </FilesMatch> <FilesMatch "."> # All other files Order Deny,Allow Deny from all </FilesMatch> This will by default deny all access for all files. Any file ending in .cgi will then be allowed. See the http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#order for more info.
Himberjack at Server Fault Visit the source
Related Q & A:
- How to remotly debug python on my apache?Best solution by blog.jetbrains.com
- How to allow user to use my app?Best solution by Stack Overflow
- How to allow specific IP access in Nginx?Best solution by Server Fault
- How do I get .jar files and .jad files on my phone?Best solution by ehow.com
- How can I allow only certain email addresses?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.