Easy Steps to Protect Your WordPress wp-admin(Admin) URL

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.


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.

#touch /etc/httpd/.htpasswd

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


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


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.


Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at Look Linux Submit Article. Stay connected to Facebook.

About the author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment