There are various reason you don’t want others to browse a WordPress directory, for example it is dangerous to open your directory structure or file directly to the vulnerability which may be possibly leaked and used by hackers. In this article, we will show you how to disable browsing WordPress directory.
Why to disable directory browsing
First of all, directory browsing can be possibly taken advantage of by hankers to see whether there’s any files related to some known vulnerabilities and further use them for malicious purposes.
Second, directory browsing can be an approach of others to see your files, and directory structure, and other secured information.
How to disable directory browsing
To do it, the only thing you should do is to add a single line of code to .htaccess file in the root directory of your WordPress.
First, connect to your website and locate a hidden file the .htaccess file in the site’s root directory. If you fail to find it on the server, then please be sure the FTP client is working.
Second, download the .htaccess file to your desktop and open it in a text editor like Notepad so that you can edit it. Now add below line at the bottom of the file:
Third, save your
.htaccess file and upload it back to your server using the FTP client.
After all these steps you will disable the directory browsing on your WordPress site and anyone try to locate a directory index on your website will be redirected to WordPress 404 page.