Wednesday, July 15, 2009

Htaccess - blocking access to folders?

On my domain, my host created a folder www.domain.com/stats



As per the host, this folder needs to stay, but as it stands now, anyone can access the data in this folder.



I want to prevent everyone (including myself and search engines) from accessing anything in this data from a browser.



Would someone have some htaccess code to allow me to do this. I prefer not to go the route of htaccess usernames/passwords, I just want to prevent all access.



Thank you



Htaccess - blocking access to folders?





Really simple:



IndexIgnore *



order allow,deny



deny from all



The first line stops browsing to that directory, just in case; it%26#039;s probably extraneous when you use the next two lines, which basically do what you want.



To undo it, though, you%26#039;ll have to have something other than web server access to your directory; shell, ftp, anything that%26#039;ll let you change or remove the .htaccess file from that directory, without using a web browser (or rather, without going through the web server on that box).

No comments:

Post a Comment