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
[code] Options -Indexes [/code]
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.
- For better Security learn to change WordPress database prefix
- Learn to remove WordPress version number
- 6 strong tips to create strong password
- 7 Top free security plugin for WordPress
If you liked the post then please share it, and to ask a question or for starting a conversation use the comment section below.