How to Password Protect the WordPress Admin Dashboard

How to Password Protect the WordPress Admin Dashboard

WordPress is one of the most popular CMS with over 35% of internet website are build on WordPress CMS at this time of writing this post. There other CMS like Squarespace, Joomla, Drupal etc but use by only fewer sites. WordPress is far ahead as compared to its competitor. Previously WordPress users to create a blog or website But now WordPress core code changed a lot as well as a massive ecosystem of plugins and theme, you can create any type of website with WordPress.

As WordPress is more popular CMS, therefore, it is the main target for a hacker. As per Sucuri WordPress accounted for 90 per cent of all hacked CMS sites in 2018. WordPress is very secure by default itself most of the security breach occurs due to use of theme and plugin from unauthorized sources.

How to Password Protect the WordPress Admin Dashboard

If you are observing some specious activity on your Hosting server. You should immediately password Protect your WordPress Admin Dashboard. In this post I will explain you you can password protect your WordPress Admin Folder.

Password Protect the WordPress Admin Dashboard [Hosting cPanel Method]-:

Most of the hosting provider uses cPanel Basically cPanel is a web-based control panel that is used for managing your web hosting service accounts. Login to your Hosting cPanel Scroll down, you will see the Security Tab, under the security Tab you will get an option of “Password Protect Directories” icon.

How to Password Protect the WordPress Admin Dashboard

once you click on the icon you will get following security setting. Select the Password Protect the Directory and give desired name to Password Protect Directory. As shown in Below Image.

How to Password Protect the WordPress Admin Dashboard

In next step create a user name and create your password. you can use password generator to generate a strong password. Click on Add/modify authorized user.

How to Password Protect the WordPress Admin Dashboard

It is all done, now your WP directories are password protected. you can check it with user name and password.

Password Protect the WordPress Admin Dashboard [.htaccess File Method]-:

You can password protect WordPress admin folder using .htaaccess file which is most important file for any WordPress website. htaccess is a configuration file for use on web servers running the Apache Web Server software. When a .htaccess file is placed in a directory which is in turn ‘loaded via the Apache Web Server’.htaccess files can be used to enable/disable additional functionality. these facilities include basic redirect functionality, for instance, if a 404 file not found error occurs, or for more advanced functions such as content password protection or image hotlink prevention…

How to Password Protect the WordPress Admin Dashboard

First, you have to create .htpasswds file. You can Use the htpasswd generator to create passwords for htpasswd files. Just enter username and password and an entry for a htpasswd file is generated.copy the code in note pad save as the file on following path.


Now create a .htaccess file  and upload it in /wp-admin/ directory. For this take a note pad paste the following line of code.

AuthName "Admins Only"
AuthUserFile /home/yourdirectory/.htpasswds/public_html/wp-admin/passwd
AuthGroupFile /dev/null
AuthType basic
require user putyourusernamehere
In above code AuthUserFile /home/yourdirectory/.htpasswds/public_html/wp-admin/passwd is path of your .htpasswds file.
Conclusion-: on WordPress CMS we can harden our WordPress website security using .htaccess file and wp-config file. I have written many posts to harden your website security to read my previous article on WordPress security click here. Keep in mind that take backup of your core file before making any changes and take your website backup on equal interval of time.

Thanks for reading…“Pardon my grammar, English is not my native tongue.”

If you like my work, Please Share on Social Media! You can Follow WP knol on FacebookTwitterPinterest and YouTube for latest updates. You may Subscribe to WP Knol Newsletter to get latest updates via Email. You May also Continue Reading my Recent Posts Which Might Interest You.

About Amar Patel 263 Articles
Hi, I am Amar Patel from India. Founder, Author and Administrator of I am a Simple Average Man who Loves life and Love living life.Professionally I am a Mechanical Engineer. Apart from my Job, I Love to write the things around WordPress WordPress CMS.