Password Protect Website using .htaccess file

1 min read

htaccess password protection can be very useful sometimes when we want only authorized users to access a certain webpage.

This can be achieved easily by creating two files :

  • .htaccess
  • .htpassword

You can create the username password file from this link :
https://hostingcanada.org/htpasswd-generator/

.htaccess file

AuthType Basic
AuthName "Password Protected Area"
AuthUserFile {PATH_TO_HTPASSWORD_FILE}
Require valid-user

We will be using username and password as :
username : letstrythis
password : pass123

.htpassword file

letstrythis:{SHA}qv3COHDsvNPVV7ZCOomCE04Xkn4=

Follow this video for complete guidance :

 

Recommended For You

About the Author: Ritesh Ghimire