Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
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.
| |
|
Topic: How to deny access to specific file using htaccess ? |
|
Author |
|
Dareros
Joined: 14 Jun 2014 Posts: 5
|
Posted: Sat 21 Jun '14 3:34 Post subject: How to deny access to specific file using htaccess ? |
|
|
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: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 23 Jun '14 11:18 Post subject: |
|
|
Code: |
<Files ~ "\.log$">
</Files>
|
|
|
Back to top |
|
|
|
|
|
|