I am new to .htaccess, i want to know how to use .htacces to prevent direct access via url of my folder e.g. localhost/mycart/images/ OR localhost/mycart/css should show forbidden message.
currently i've put index.php in every folder of my website and echo the messages is it good way to do it.
when i access my website like www.mycart/index.php/css or www.mycart/index.php/images it show website without images and css why and how to fix it?
The 403 Forbidden error means that your server is working, but you no longer have permission to view all or some of your site for some reason. The two most likely causes of this error are issues with your WordPress site's file permissions or . htaccess file.
I have used
# disable directory browsing
Options -Indexes
Conversely, to enable directory browsing, use the following directive:
# enable directory browsing
Options +Indexes
Likewise, this rule will prevent the server from listing directory contents:
# prevent folder listing
IndexIgnore *
And, finally, the IndexIgnore directive may be used to prevent the display of select file types:
# prevent display of select file types
IndexIgnore *.wmv *.mp4 *.avi *.etc
Courtesy From: Prevent Unauthorized Directory Browsing from Stupid HTACCESS Tricks.
It also contains many other useful commands to be used in .htaccess
for security and performance enhancement.
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