07-22-2023, 04:28 AM
How to protect a website with a password
- To protect access to your website via username and password authentication, you will need to upload an .htaccess file and an htpasswd file to the root of your FTP account, using FileZilla or a similar FTP transfer software.
.htaccess file will contain the path where the username and password authorized to access it are stored. It should contain the following code:
AuthType Basic
AuthName "Authentication name"
AuthUserFile /var/www/Mydomain.com/htdocs/.htpasswd
Require valid-user
The term Mydomain.com should be replaced by your domain name.
- The
.htpasswdfile will contain the user name authorized to connect as well as its password, which will be encrypted. The creation of the.htaccessand.htpasswdfile can be done via a text editor such as Notepad.
Information: the .htaccess and .htpasswd files are hidden files, so it is possible that when you make an FTP connection via an FTP transfer software, you do not see them. In this case, it will be necessary to display the hidden files on your software.

