Password Protect Your WordPress Admin Directory
Few days ago, I started seeing some suspicious activity on my other WordPress blogs, so our host company advised me to password protect my WordPress admin directory. Apparently popular sites like Mashable, Labnol do the same. In this article, we will show you a step by step guide on how to password protect your WordPress Admin Folder (wp-admin).
WordPress Installation Directory Has 3 Main Folders:
- The wp-content folder includes all your themes, plugins, images and other files.
- The wp-includes folder includes all the PHP functions.
- The wp-admin folder is the front-end for WordPress admin, authors and and other members.
How To Secure wp-admin Directory Of WordPress With A Password
Go to your WordPress admin folder (at /home/stiffin/example.com/mywordpress/wp-admin/) and create a new .htaccess (use the vi command or create the .htaccess file on your desktop and upload it to wp-admin folder using FTP).
Step 4. Paste the following text into your new .htaccess file and replace the folder path in Line #3 with your own actual path. Save the changes.
AuthName "WordPress Protected Area"
Allow from all
Allow from all
Step 5. Go to the WordPress root folder (/home/stiffin/example.com/wordpress), open the .htaccess file for editing and add the following lines outside the #BEGIN WordPress and #END WordPress block.
#Do not display Authorization Error Message
#Instead, redirect to the blog home page
ErrorDocument 401 /