For example, to protect the admin folder, go through the following two steps:
Step one, you can create a new file with Notepad. htaccess, enter the following:
AuthType BasicAuth
UserFile d:/appserv/www/hill/admin/.htpasswd
AuthName "Hill"
Require Valid-user
Each row does not explain more, the key is the second line, must be absolute path, represents the location of the. htpasswd file. (arbitrary position)
Then put the file named. htaccess in the Admin folder.
The next step is to create a new file named. htpasswd that should be consistent with the second line above.
Easy way: Start-run-cmd-apache>bin\htpasswd-c. htpasswd Name
The following is the input password, is through MD5 encryption.
When you are finished, place the file named. htpasswd at the location specified in the second line.
Again explain userfile the second line, it took me a long time to get it right, if the hint 500 error is the wrong path. The location of the Atbhost space is the/home/registration name.
Atbhost Space provides a place to store passwords:. Htpasswds
To protect your. htaccess file.
Htaccess is too strong, but it itself will not be cracked, how can I protect it?
A: When you use. htaccess to set the password protection for a directory, it contains the path to the password file. From a security point of view, it is necessary to protect the htaccess, and not let others see the content. Although this can be done in other ways, such as the permissions of the document. However, htaccess itself can do so by simply adding the following instructions:
Copy Code code as follows:
<files .htaccess>
Order Allow,deny
Deny from all
</Files>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.