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

6 Best Online Grocery Apps for Android in India

All of us know that the revolution brought by technology is very amazing and the interesting fact about the...

5 Best Android apps for doctor appointments in India

We all have to visit doctors either frequently or within small to big gaps for every small and big...

Best Android Racing Games on Speed Boats and Ships

No doubt that there is an ocean of games available in our favourite store and this the time when...

Differences between a laptop and a notebook PC

When it comes to portable computers both laptops and notebooks are the two most popular, and available choices for...
- Advertisement -

Why you shouldn’t root your Android handset in 2020?

Everybody wants to get the most out of their smartphones as a smartphone is always a costly investment, and...

Best Free video conferencing software in 2020 during Covid19

In 2020, the usage of video conferencing solutions or websites, for both companies and individual has been surged up...

- Advertisment -
- Advertisement -

You might also likeRELATED
Recommended to you