logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: How to deny access to specific file using htaccess ?
Author
Dareros



Joined: 14 Jun 2014
Posts: 5

PostPosted: Sat 21 Jun '14 3:34    Post subject: How to deny access to specific file using htaccess ? Reply with quote

Hi;

I would like to deny access to .log files but with an additional condition, if the requested filename of the log file exist than deny access but if the requested filename doesn't exist than do nothing. Example, i have in my web server a file called web.log so the request http://example.com/web.log should be denied but the request http://example.com/webo.log shouldn't be denied because the file webo.log doesn't exist. So i need to check first if the file exist, if yes deny if no do nothing. The traditional command which is :

<Files ".log">deny from all</Files> doesn't check if the requested file exist or no, so i need to add condition to check the existence of the file before applying the rule, so how to do that with .htaccess ?

Thank you.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Mon 23 Jun '14 11:18    Post subject: Reply with quote

Code:

<Files ~ "\.log$">
</Files>
Back to top


Reply to topic   Topic: How to deny access to specific file using htaccess ? View previous topic :: View next topic
Post new topic   Forum Index -> Apache