Disable directory browsing.

At the tea shop, some fellows were talking about Directory browsing in WordPress this evening and it is a security threat. People with bad intent could easily download all your files. Yes, I need to disable directory browsing for a site, but how? I heard there are some plugins available to do that. Let’s do it without a plugin.

I arrived home and I logged into my cPanel and then navigated the cursor to the “File manager”, then to “public_html” folder and there I found the .htaccess file. I then right-clicked on that .htaccess file, it showed me the menu and I chose “edit” from that menu. It opened the file in the editor. I simply added a line at the very bottom of that .htaccess file. I saved the file and closed the editor. It was only that.

Now it is not possible to browse any directories anymore. I want you to do it too.

Note: If .htaccess file is not seen in the “Public_html” folder, then please see this “Prevent Username enumeration in WordPress” post and that will help you.

I added the following line at the bottom of the .htaccess file. Please copy this line and paste it into the .htaccess file and save it and close the “Editor”.

Options All –Indexes

Good luck.

Leave a Reply

Your email address will not be published. Required fields are marked *