Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deny access to website folders

I have seen several websites: for example http://www.website.com/images/pic001.jpg And when I try to access http://www.website.com/images/ is prohibited. That is exactly what I want to protect my folders from curious. How I can I accomplish this? Adding some instructions into the. htaccess? Changing Folder permissions? Thanks, I hope I explained well, and sorry for my horrible way of writing in English P.D.: My website is hosted on 000webhost. Grettings!

like image 901
candlejack Avatar asked Jan 16 '26 21:01

candlejack


2 Answers

You can add Options -Indexes into the .htaccess file in the images folder, this results in a forbidden message if one tries to access /images/, but access to /images/pic001.jpg is still possible.

For more information see here: http://wiki.apache.org/httpd/DirectoryListings

like image 52
Simon Fischer Avatar answered Jan 19 '26 16:01

Simon Fischer


You likely mean to allow access to the images but preventing browsing. You can disable browsing of a folder when there is no index if you add Options -Indexes into your .htaccess in your images folder.

like image 32
Cosades Avatar answered Jan 19 '26 16:01

Cosades



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!