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.
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.
- WordPress plugin should have on Every WP website.
- 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 example.com/myadminurl ).
- 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
- First of all, need to login to your Cpanel.
- Then and Directory Privacy.
- After that select the directory, which you want to protect. In our case directory is WP-admin.
- Next, click on the checkbox labeled Password protect the directory. Make sure you have a name for the folder you are going to protect.
- Create Username.
- Add Password and re-enter the password.
- 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.
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.
- Login to WordPress Dashboard.
- Than SEO and File editor.
- After that in the .htaccess area paste the code below.
- Hit save! you have done.
AuthName "Admins Only"
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.
Allow from all
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.