.htaccess file protection not working

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

.htaccess file protection not working

Post by kaisellgren »

Hi,

I use

Code: Select all

<FilesMatch "\.txt">
Order allow,deny
Deny from all
</FilesMatch>
To block visitors access to all .txt files in the directory where the .htaccess is placed. However, this obviously does not work. It blocks visitors from seeing the file in the directory listing, but if I type full path to any txt file I will see the contents of that file easily.

How do I block access to all .txt files ENTIRELY?

Thank you for your help!
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

change the order of your order directive to deny,allow

or

add Allow from none above your deny from all..

the order directive is "order" specific... so, if you put "Order deny,allow" apache is expecting deny from <whomever> to come first... conversely if you put "Order allow,deny", it would expect Allow from <adfasdf> first...
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Post by kaisellgren »

Tried without luck.

Code: Select all

<FilesMatch "\.txt$">
Order allow,deny
Allow from none
Deny from all
</FilesMatch>
Post Reply