Do you want to disable directory browsing in WordPress? In this post, we will show you the simple tutorial for disabling directory browsing.
Why This Happening?
When a website got no index.html or index.php file available, the web server will show its contents. These days, this is not safe at all. Hackers can find security holes and can break your WordPress blog.
How To Disable Directory Browsing In WordPress?
All you need is, edit the.htaccess file and add a single line of code on it. You can do it by using the Yoast SEO plugin’s .htaccess editor or by using the cPanel editor. For this tutorial, we are using the Yoast’s editor.
First of all, go to your WordPress dashboard. Make sure that you have activated the Yoast SEO plugin. Under the tools section, open the file editor.
Find the .htaccess editor there.
Now, copy the below code and paste it just at the end of .htaccess.
Now, simply save the file.
From now on, the web server will show a forbidden error when a visitor tries to access a directory without an index file.
We hope you found this tutorial interesting and helped you. If you did, please consider sharing our post with your friends on social media. For more security tips and hacks, you may want to check our WordPress security guide.