I have this current directory structure
myproject
--> application
--> assets
--> data
--> scripts
--> styles
--> system
--> .htaccess
--> favicon.ico
--> index.php
I store my users uploaded images, videos on the data directory, and it has this structure:
data
--> 5
--> thumbs
--> user_images
--> 6
--> thumbs
--> user_images
--> index.html
I placed index.html to prevent directory access. I can do this to all the data subdirectories to have the same effect, however is there a way to have this handled by .htaccess? I tried Deny from all
rule in the .htaccess but it also won't allow me to use my images in my system. All I want to achieve is to prevent directory access (when direct access from URL) from my data directory. How is that?
Directory listing is a web server function that displays the directory contents when there is no index file in a specific website directory. It is dangerous to leave this function turned on for the web server because it leads to information disclosure.
If you are expecting to see an existing site however, and instead you see the directory listing something has gone wrong somewhere. The file may have been infected via a php injection attack and removed by a malware scanner. The site may have been attacked. Your account password may not be very secure.
In your .htaccess
, add the following line:
Options -Indexes
See the manual for further details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With