How To Prevent Directory Browsing With .htaccess

Sometimes a viewer of your website can change a few characters in the URL of your site and continue to browse your directories. It sounds fun but could be very dangerous for your website. It’s called directory browsing.

I will recommend you to prevent/disable directory browsing on your website. Just add following snippet to your .htaccess file and save it:

If you wanna to enable directory browsing on some particular directory just add the following snippet: