How to Password Protect Your WordPress Admin Directory

We all know that the wp-admin directory is already being protected by login password, but to add an additional layer of security you can also password protect your Wp-admin directory. This will protect your website root folder files even if a Hacker somehow manages to break your login password.

To keep things quick and easy, we will use cPacnel to protect our admin folder.

Steps to password protect your Wp-Admin

  • Login to your Account, Scroll down till you see Security Tab and then click on the “Password Protect Directories”.

How to Password Protect Your WordPress Admin Directory


  • A popup will appear asking you to provide the directory location. Click on Web Root Public_html. After that click on the folder which you want to password protect.
  • Choose your Desired username and password.

How to Password Protect Your WordPress Admin Directory


Now whenever you try to access your wp-admin directory a authentication box will appear asking you to fill up the required details.

Every file don’t need to protected in wp-admin folder, right?

So you need to create a .htaccess file in wp-admin folder and add this code in it.

AuthType Basic
AuthName “Restricted Access”
AuthUserFile “/xxxxxxxxx/passwd”
require valid-user

# WordPress Security

<FilesMatch “\.(ico|pdf|flv|jpg|jpeg|mp3|mpg|mp4|mov|wav|wmv|png|gif|
Allow from All
<FilesMatch “(async-upload|admin-ajax)\.php$”>
Order allow,deny
Allow from all
Satisfy any

# WordPress Security

This will allow access to the files mentioned in this rule without requiring a password.

Found this post useful Follow us on Facebook or Twitter to get more Updates