Prevent Accessing Directory Folders In WordPress

Disable wordpress directory folder access is always a good way. WordPress directory files can be accessed easily by migrating to their root directory followed by sub folders. So it is also a security tip to prevent wordpress blog from being hacking. Among many security tips available to prevent wordpres blogs from hacking. We need to include stop directory folder listing in wordpress as an important point.

Block directory listing in wordpress
Block directory listing in wordpress

How to access wordpress directory files?

If you have such question and want to find wordpress directory files are accessed. Then it would as shown below.

http://your-site.com/wp-content/uploads/2013/

I was worried when I viewed my directory files and every one are able to watch all my uploads and it’s really a bad thing that should be considered seriously by every blogger. Accessing directory/root folders would give your competitors about your plugins, data, images and everything. So we will block accessing root directory folders in wordpress by editing .htaccess file. You can edit it in few ways. If you use WORDPRESS SEO YOAST PLUGIN then you can edit from SEO >> Edit files then you can add the code in .htaccess file.  If you use Robots meta plugin >> then you can go to settings > Meta robots and edit your .htaccess file.

ALSO READ :   CHANGE DEFAULT ”  Admin ”  USERNAME IN WORDPRESS ( Security Tip )

Now you can add a single line of code after all the .htaccess code and that will block your directory listing. If you use FTP account, like FileZilla or Web Based FTP then you need to login into your account. After logging in and in root you would be able to see .htaccess file. If  you don’t find them, remember you have enabled hidden files so right click “Show Hidden Files” to see your .htaccess file.  Before you make any change, I recommend you to create a backup of existing .htaccess file.

Default wordpress .htaccess file would be like this :

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
IfModule>

# END WordPress

Then you need to add   ”  Options All -Indexes  ” at end of the code. Modified .htaccess code would be like

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
IfModule>

# END WordPress

Options All -Indexes

Now you can save changes. Now you have successfully locked listing your directory folders and prevented it from hackers. Congrats. There are many more security tips to prevent your wordpress blogs. So do subscribe to get instant updates.

Article By Tharun

Hey! Tharun here. A Blogger makes blogging on wordpress tips, blogger tricks, SEO tricks, Android Apps, He love to share what he knows. Meet him at Facebook, Twitter. Get free Wordpress Installation Service Contact Here.

Leave a Reply