In the web server default setting make it visible automatically the contents of the directory. This may make your server vulnerable to attack by revealing the most important information to the attackers. Here we can discuss how to disable the directory browsing in wordpress.

Directory browsing can be used by hackers to find out if you have any files with known vulnerabilities, so they can take advantage of these files to gain access. Directory browsing can also be used by other people to look into your files, copy images, find out your directory structure, and other information. This is why it is highly recommended that you turn off directory indexing and browsing. To disable directory browsing in WordPress all you need to do is add a single line of code in your WordPress site’s .htaccess file located in the root directory of your website.

You can do this by editing the .htaccess file by launching the FTP tool or by accessing the control panel directory browsing. Now add the following code into the bottom of .htaccess file. 

Options -Indexes

Now the directory browsing in your wordpress is disabled. Anyone who trying to locate a directory index on your website will be redirected to WordPress 404 page.