Why and How to Prevent Directory Browsing in WordPress

What is Direcoty Browsing

In our website, if there is no index file likes index.php, index.html etc. in the homepage or folder, then our web page shows the all files like the file manager. So, if a visitor visits the folder then the visitor can show all files and folders. The visitor will get all internal files.

Disable

Hackers take this facility. The hackers try to find out if you have any files with known vulnerabilities. So, you need to disable this directory browsing.

How to Disable Direcoty Browsing

Easily we can disable this. We are going to disable this via .htaccess file. Okay just follow this steps.

First, login to your CPanel. Open file manager. Or, you can use FTP client. You can use FileZilla – The free FTP solution.

Once you connected with FTP, go to the root of your website’s directory. If there is a .htaccess file, edit the file. Or if there is no .htaccess file, just create a file named .htaccess. Then edit the file.

Now at the end of your .htaccess file, add this line.

Options -Indexes

Don’t forget to save the .htaccess file before closing. That’s it. I hope this article will help you.

Read all security tips and tricks about WordPress: The Powerful WordPress Security Guideline – Simple Tricks


Software Engineer | Ethical Hacker & Cybersecurity...

Md Obydullah is a software engineer and full stack developer specialist at Laravel, Django, Vue.js, Node.js, Android, Linux Server, and Ethichal Hacking.