As we know WordPress is the most popular and famous CMS (Content Management system) which is used in the world. It is also free and open-source content management system which is based on PHP and MySQL. We can easily create website and blog. WordPress is fastest growing content management system software. It is user-friendly everyone can easily manage without web designer. There are lots of plugins and theme is available on internet. In this tutorial I am going to explain how we can setup password protected WordPress wp-admin URL.
STEP 1#: CREATE .HTPASSWD FILE
To create htpasswd file you will need to shell access to create htpasswd file using command line. You will also need to decide in which directory you will use to create this file. I will suggest create this file outside Apache document root.
Follow the below command to add your first user in .htpasswd file. You can also generate htpasswd online using online htpasswd generator if you don’t have shell access.
#htpasswd -m /etc/httpd/.htpasswd username
STEP 2#: .HTACCESS CONFIGURATION
Create a .htaccess file in wp-admin directory and add below content. Make sure your AuthUserFile path properly configured as per your location.
# Protecting wp-admin URL AuthType basic AuthName "You are not authorised to access this directory" AuthUserFile /etc/httpd/.htpasswd AuthGroupFile /dev/null require valid-user <Files admin-ajax.php> Order allow,deny Allow from all Satisfy any </Files>
STEP 3#: ACCESS WP-ADMIN DIRECTORY
Now your wp-admin directory is password protected to check this visit your WordPress website home page you can access it easily but when access wp-admin directory, it will prompt to type User Name and Password.
I hope this article will be helpful to setup password protected WordPress wp-admin URl. Read our another article Mail Command Installation On Redhat, CentOS, Fedora, Ubuntu and Debian System and IoT – A Beginner’s Guide to know about Internet of Things. If you have any queries and problem please comment in comment section or you can also ask your question.