How to disable wordpress directory for wp-content and wp-uploads. and Redirected to “404” Page
Web-server does not contain index file like (index.php, index.html). It automatically shows all the files and directories. This could make the site vulnerable to hack attacks by revealing all the files and directories. hacker will easily attack out themes and plugins files. In this post, i will show you how to disable directories and files in WordPress.
To disable directory listing we have to add single line of code in our WordPress “.htaccess” files. This file located in the root directory of WordPress website. To edit this file login into cpanel and find the “.htaccess” file. sometime It will be in hidden file. Once we found “.htaccess” file.
Disable Directory Files
You can edit your htaccess file by using text editor or notepad. Now End of WordPress generated code in the “.htaccess” file easily add this below line at the bottom.
“Options -Indexes”
Now you can save your file. That’s all you need to do. Now Directory and files are in disable mode. If people trying to locate a directory It will be redirected to wordpress “404” page.
I hope this article helped you learn how to disable directory and files.