How to Password Protect the wp-login.php File
There are two (2) steps in accomplishing this:
- First, you need to define a password in the
.wpadmin
file.
create the file in your main directory then put the username and encrypted password inside the.wpadmin
file, using the formatusername:encryptedpassword
EXAMPLE:
password encrypted website link: https://hostingcanada.org/htpasswd-generator/john:n5MfEoHOIQkKg
- upload below code in
.htaccess
file-
ErrorDocument 401 "Unauthorized Access"
ErrorDocument 403 "Forbidden"
<FilesMatch "wp-login.php">
AuthName "Authorized Only"
AuthType Basic
AuthUserFile /home/username/.wpadmin
require valid-user
</FilesMatch>