views:

124

answers:

3

How can I protect a folder using .htaccess? I want the folder /files/myfiles to only be accessed by the server, not by a user? How can I do that?

+2  A: 

Add the .htaccess file to /files/myfiles folder with the following in it:

deny from all

Internally when your scripts look for files they aren't going through Apache, only when someone requests it on port 80. So this will deny any listing and permissions to them.

Garrett
Well, yeah but I have some...files such as images..which i nuse them on the UI, so i need access for the server..
Uffo
Should have been more clear in your question then. :)
Garrett
+1  A: 

I would add the following to an .htaccess:

order deny,allow
deny from all
allow from localhost
allow from 127.0.0.1 // incase your loopback isn't configured correctly
allow from 192.168 // incase software isn't using your loopback correctly

Hope that helps!

Al
A: 

I found this thing: Options -Indexes is hiding directory listing

Uffo