Protect with .htaccess and .htpasswd:
-
Create a
.htpasswdfile:
Use an online htpasswd generator to create a user and encrypted password.
Save it outside the public directory (e.g.,/home/username/.htpasswd). -
Edit your
.htaccessfile:
Open the.htaccessfile in the root of your WordPress site, or create one in the same directory aswp-login.php:⚠️ Replace
/full/path/to/.htpasswdwith the actual path to your.htpasswdfile. -
Save and test:
When you visitwp-login.php, it will now prompt for a username and password before showing the login page.

Leave A Comment