Protect with .htaccess and .htpasswd:
-
Create a
.htpasswd
file:
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
.htaccess
file:
Open the.htaccess
file in the root of your WordPress site, or create one in the same directory aswp-login.php
:⚠️ Replace
/full/path/to/.htpasswd
with the actual path to your.htpasswd
file. -
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