Rate this article :
5/5 | 2 opinion
This article was useful to you ?
Yes
No
Vous avez noté 0 étoile(s)
Sommaire
Procédure
This documentation guides you step-by-step through securing access to a specific directory on your web hosting using password protection. There are two ways to do this:
.htaccess and .htpasswd files if you prefer to manage the configuration yourself.Protecting a directory with a password is essential when you have sensitive or private information that you only want certain people to have access to. This can be useful for directories containing administrative files, documents reserved for a team or confidential data. This protection ensures that only authorised people can access these files.
Important details
.htaccess and .htpasswd files directly..htaccess file.

.htaccess and .htpasswd are created and placed in the directory to be protected. Do not delete them, otherwise the directory will no longer be secure.If you prefer to manage the password protection configuration yourself, you can create the .htaccess and .htpasswd files manually. Here's how to do it, step by step.
The .htpasswd file contains the credentials (username and password) used to access the protected directory. This file must be placed in a secure location, out of reach of visitors to your site.
.htpasswd file. IMPORTANT: It is recommended that you do not place it in the directory you want to protect. You can create a private folder at the root of your site, such as private/, to put this file in..htpasswd in this directory.Add a username and password to this file in the form :
username:password
Example: If you want the user to be "admin" with the password "secret123", you should first encrypt the password (you can use an online generator for this). After encryption, it could look like this:
admin:$apr1$N9j7h9gk$JdFqjD/yDg2wMNtnTsdwU.
You can use online generators such as htpasswd generator to create the secure password.
The .htaccess file is responsible for managing access rules to your directory. It must be placed in the directory you wish to protect. If the .htaccess file already exists, you need to modify it.
private folder)..htaccess file doesn't already exist, create it in this directory. If this file already exists, open it to edit it.Add the following lines to the .htaccess file to enable password protection:
AuthType Basic AuthName "Protected space" AuthUserFile /path/to/.htpasswd Require valid-user
Explanation of lines :
AuthType Basic: This defines the type of protection (here, basic password protection).AuthName "Protected area": This text will appear in the login request dialogue box. You can customise it (for example: "Restricted access").AuthUserFile /path/to/.htpasswd: This is where you specify the absolute path to the .htpasswd file you created in the previous step. Example: if the .htpasswd file is in a private folder, the path could be /home/user/private/.htpasswd.Require valid-user: This means that a valid user, whose username and password are in the .htpasswd file, will be able to access the directory.IMPORTANT: Make sure you use the absolute path to the .htpasswd file, so that the server can find this file wherever it is located.

.htpasswd file is correct and that the file contains valid encrypted credentials..htpasswd file is in a secure directory and that its path is correctly specified in the .htaccess file..htpasswd file contains the encrypted credentials and that it is correctly formatted..htpasswd file. Use an online encrypted password generator to generate a new secure password..htaccess file is in the correct directory and that it is correctly named (with a full stop in front of it).Protecting a directory with a password is a simple and effective method of securing sensitive information on your website. You can choose to do this via the LWS Panel, which automatically generates the necessary files, or manually by creating and configuring the .htaccess and .htpasswd files yourself. Both methods ensure that only people with the right credentials can access the contents of the directory.
Rate this article :
5/5 | 2 opinion
This article was useful to you ?
Yes
No
1mn reading
0mn reading
How do you download or restore a backup of your web files?
0mn reading
How do you back up or restore your emails?
0mn reading
How do I download or restore a Mysql database backup?