If you are still not able to figure out, what did I meant stating disable directory browsing in WordPress?
Then, let me make it clear that, if the owner of the website doesn’t disable directory browsing, then any of the visitors can access their root files saved in their hosting directory.
By default, WordPress shows all the content of the root directory like plugins, themes, Media, and other files which don’t contain index.php file in it.
How can the hackers access the WP root files?
All they have to do is typing www.yourdomainname.com/wp-content/uploads in the browser
check out the below example, how the whole directory of content pops up with a simple URL along with the parent directory.
Sounds scary, isn’t it?
Yes, certainly it would be. When it comes to securing the WordPress website, this is quite underestimated one. Though, quite important. You can’t open the doors and make your site vulnerable to the attacks.
We will see in this article how to disable directory browsing in WordPress for better security.
Disable Directory Browsing in WordPress
The trick is quite simple, we just need to head over to your WordPress Root directory to access the .htaccess file.
Step 1. Login to your Control Panel – File Manager
Step 2. Click on public_html, and find .htaccess file in the WordPress root directory.
Step 3. Right Click on it, and Click on Edit.
This will open the file in the text editor. There at the bottom add below given one-line code.
# Disable directory browsing Options All - Indexes
Step 4. Hit the Save Changes button.
That’s it, you are done and disabled the directory browsing in WordPress and blocked access to your core WordPress files.
To test it you can reload the same page, not it might show an error page or some other page preferred by you.