Set up Password Protected Admin directory (Wp-admin) in WordPress

Hi guys, in this post I am talking about WordPress password protected admin directory. All of us know that WP is open-source CMS. One more thing security is your own work. Many plugins are available in many marketplaces, that solves your problems within a click. The protected directory is also a part of the security of your weblog or website.Password Protected Admin directory

Why we are protecting admin directory?

Due to some security reasons, you should absolutely use “Password protected admin area” to secure it against hackers. Protect WP-Admin fixes a glaring security hole in the WordPress community. Millions of millions of websites are hacked per day by hackers. So password protected directory add an extra layer of security. I will always suggest you add Full WordPress Backup solution. With the help of backup, you can restore your blog site within some clicks.

Now come on the topic How to protect it?

Must Read: A to Z Security guides For WordPress Blog or Web sites.

How to password protected Admin directory WordPress?

There is three way to do this. first one is plugin method, the second one is through Cpanel and through .htaccess. The third method is much easier than other but Cpanel has more secure, as well as plugin method, have more functions. You just need to install WordPress plugin and set up correctly. You have done.but in the Cpanel method you need to do some hard work for this. Here I will describe you all above method. Use method which you like.

Must Read:

  1. WordPress plugin should have on Every WP website.
  2. WordPress SEO tutorials for newbie bloggers.

How secure admin directory with Plugin on WordPress?

There are many plugins available in WordPress plugins repo, where you can download and install the plugin on WordPress. But I recommend you to use protect your admin by MR web solution. Just Install the plugin and activate it.

Protect Your Admin

Why use Protect your admin plugin?

There are many useful features have in this plugin. Some of them –

  • Change Admin directory ( Like ).
  • Change WordPress login page logo and Background color.
  • Make login and register URL SEO friendly.
  • Restrict guest and Non-admin users to access the wp-admin directory.
  • 20000+ times download and 4 stars on their repo.

How to setup password protected directory using Cpanel

  1. First of all, need to login to your Cpanel.
  2.  Then and Directory Privacy.cpanel directory privacy
  3. After that select the directory, which you want to protect. In our case directory is WP-admin.
  4. Next, click on the checkbox labeled Password protect the directory. Make sure you have a name for the folder you are going to protect.cPanel wp admin directory select
  5. Create Username.
  6. Add Password and re-enter the password.
  7. Hit save.

Password Protected Admin directory in WordPress using .htaccess

I recommend you that backup your full site as well as the database before start using this method.First of all, you need to create a file named .htpasswords or you can use .htpasswords generator to generate files. Upload this file to outside the Public_html folder.

Example: home/user/.htpasswds/public_html/wp-admin/passwd/

Now you need to edit your .htaccess file or create new if you don’t have. In my case, I am using WP SEO plugin for editing .htaccess files. you can manually edit the file.

  1. Login to WordPress Dashboard.
  2. Than SEO and File editor.SEO htaccess edit
  3. After that in the .htaccess area paste the code below.
  4. Hit save! you have done.
AuthName "Admins Only"
AuthGroupFile /dev/null
AuthType basic
require user putyourusernamehere

Note: Before proceeding ahead change AuthUserFile and username also.

Are you getting Admin Ajax error? let’s fix it.

One of the biggest problems of Password protected Admin Directory is that it breaksAjax function. If you are using any Ajax function on your website or Blog than add some code and you have done. You can fix it by adding some line of code in your .htaccess file.

<Files admin-ajax.php>
Order allow,deny
Allow from all
Satisfy any

Are you getting too many 404 Error or redirection? Fix it.

Fixing this you need to add some line of code on your.htaacess file and your work is over.

ErrorDocument 401 default

The Conclusions – Here I have discovered How to Password protect WordPress Admin Directory. I have described all the method which,  I have used or tried. If you are getting any type of error or need help feel free to ask me. Comment below, I will happy to help you. Follow @thebloglogic on Twitter and Facebook Sharing is sex Happy Blogging.

Add a Comment

Your email address will not be published. Required fields are marked *