How to stop directory listing or Index browsing in Wordrpress via htaccess

- Advertisment -
- Advertisement -

Disabling of directory browsing in WordPress is necessary to mitigate the vulnerability attacks since it shows all available files in the content directory.

Now, What is directory browsing in WordPress?

Once we installed and access our web server using a browser, by default it immediately looks for index.php or html to show something, however, if any of them is not available, it will display other files of the same directory. Such as images, text files etc. Thus, in case you are using some plugin or theme which is old or vulnerable, any hacker can easily know about them. Therefore, it is a good idea to disable directory browsing unless and until you don’t need it deliberately to show some content.

WordPress htaccess-directory-listing -min

Disable Index or Directory browsing in WordPress without any plugin

We can stop listing of files in WordPress without any plugin, what we need is only the access of .htaccess file.

  1. Go to your hosting Cpanel.
  2. Open File Manager.
  3. Click on the Public_html folder or where ever you have your website WordPress files.
  4. Select the .htaccess file and click on the Edit button given on the top.

    edit htaccess file to stop listing of files wordpress
  5. In the .htaccess file scroll down to the bottom and simply add this line:

    Options -Indexes
  6. Click on the Save Changes button given on the top right side.
  7. Now again try to list the index files or directory of WordPress in the web browser, however, this time you will get a message that the page has been deleted or move with 404 output.

Stop directory listing in WordPress using Yoast SEO

If you already a user of popular Yoast Plugin then you don’t have to look for any other plugin or CPanel. Just click on Yoast SEO option given on the left side in the WordPress Admin Dashboard.


Click the File Editor to quickly edit files such as robots.txt and .htaccess files.


Now, simply go to .htaccess section and scroll down to the end, where just paste this value: Options -Indexes

htaccesss listing of files on wordpress disable

Hit the Save Changes to .htaccess button.

H2S Media Team
H2S is a group of tech enthusiasts those are passionate about latest technology developments. They always like to solve own technical problems and share the same solution with others through this Website.


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest Posts

How to split and break files on a Windows computer using HJSplit

We all come across files that are a few Gigabytes or Terrabytes in size. We can easily back them...

How to install Akaunting on Windows 10

Akaunting software which is a free and open-source web-based application for finance & accounting purposes. Here we will see...

Future of the Gaming Industry in India 2020

With the population of 1.3billions, India automatically becomes the biggest market for any industry if even...

How to install IIS web server on Windows 10 Step by Step

IIS (internet information services manager) on Windows 10/7 Desktop or server is basically a flexible and secure Web server...
- Advertisement -

How to assign labels to emails on Google Mail or Gmail to organize emails

We get hundreds of emails every single day, and among all that we get, only a handful of them,...

Top 10 myths related to technology that you should stop believing

Today, when we talk about tech, the 90’s kids and the Millenials mostly refer to the latest smartphones, LED...

- Advertisment -
- Advertisement -

You might also likeRELATED
Recommended to you