When a folder got no index.php file or index.html file, the web server will start to show its contents. These days, you must prevent the unauthorized users from looking inside your directory. Last day, one of our users asked about WordPress directory browsing and the prevention. In this post, we will show you that, how can you disable directory browsing in WordPress.
How To Prevent WordPress Directory Browsing?
I hope most of you are using WordPress SEO by Yoast plugin. If you are, this will be pretty easy for you. If you are now, you need to use an FTP account or access the file manager.
All we need to do for disabling directory browsing in WordPress, edit the .htaccess file and add a single line of code on it. So, let’s begin.
Using Yoast SEO
First of all, you need to login to your WordPress dashboard and go to the tools section under the Yoast SEO section. There you can see the file editor.
There, you can see the .htaccess file of your blog.
You need to enter the below code into the .htaccess. After that simply save the file.
WordPress directory browsing is simply disabled!
Log in to your cPanel and access file manager. Then you need to go to the public_html folder. There, you can see the .htaccess file.
If you haven’t seen it, you need to enable the show hidden files feature.
Simply edit the file and add the code we mentioned above.
We hope you found this post helpful and enjoyed the read. If you did, please share this post with your friends and fellow bloggers. Also, for more tutorials, you need to check out our blog section.