Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess deny access to all except to one file

Tags:

.htaccess

How can I deny access to a complete folder and sub-folders, with the exception of one file? That file is: toon.php and resides in the same folder.

like image 576
richardverbruggen Avatar asked Aug 04 '10 16:08

richardverbruggen


People also ask

What does htaccess Deny from all do?

You just need to add a few commands to . htaccess to make it happen. For example, deny from all is a command that will allow you to apply access restrictions to your site.


2 Answers

Order Allow,Deny <FilesMatch "^toon\.php$"> Allow from all </FilesMatch> 

That is probably the most efficient that you can get.

like image 172
MickeyRoush Avatar answered Sep 24 '22 08:09

MickeyRoush


AuthGroupFile /dev/null AuthName "Private Area" AuthType Basic AuthUserFile .htpasswd require valid-user   <Files "toon.php"> Allow from all Satisfy Any  </Files> 

Works for me. Dont' forget to configure the .htpasswd file.

like image 37
Charley Ramm Avatar answered Sep 22 '22 08:09

Charley Ramm