How to stop access to directories in wordpress

Showing indexes can be harmful for the security of your website. The files shown in the index can be used to hack your website. Directory browsing is there when browser fail to get the index.php or index.html files.

Why to stop access to directories in WordPress?

When your directories can be accessed by anyone on the internet then you are vulnerable to the hacks and security breach. When some one is able to browse the directories then they know the structure of the website as well as the files of the theme and plugins, after getting a hold on files they can get the loose ends in the code and can target that to get into your website admin panel.

By getting access to the directories people also gets a hold to all the images with directory structure. They can copy them and can know the valuable directory structure information, with are really important for website security.

How to stop access to directories in WordPress?

To stop access to directories is easy, you just have to add a single line code to your .htaccess file.

.htaccess file is located in the root directory, to access that you have two options first through file manager in your hosting cpanel or by using an FTP client.


when you login to your ftp client you should note that it is configured to show hidden files. Now you have to go to the .htaccess file and right-click on it and select the option of view/edit. Now open the file in text editor of your choice, now at the end you have to enter the code

 Options -Indexes 

Now hit save and upload the file back to the server.

That’s it you have successfully stopped access to directories in WordPress, Now when someone try to browse the directories they will see a forbidden message.

We are listing some more useful tutorials that can be helpful, For a complete list you can visit our Tutorial section in the menu.

Also Read:

If you liked the post then please share it, and to ask a question or for starting a conversation use the comment section below.

You can follow us on twitter, facebook, Google+

Team Zdidit

Team Zdidit take care of all the content creation for zdidit. This team is supervised by Achin Verma

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *