For example, to protect the admin folder, follow these two steps:
Step 1: use NotePad to create a file. htaccess and enter the following content:
Authtype basicauth
Userfile D:/appserv/www/hill/admin/. htpasswd
Authname "hill"
Require valid-user
Each row does not explain much. The key is the second line. It must be an absolute path, indicating the location of the. htpasswd file. (Any location)
Put the file named. htaccess in the admin folder.
Step 2: create a file named. htpasswd. The name should be the same as that of the second line above.
Simple Method: Start-run-cmd-Apache> bin \ htpasswd-C. htpasswd name
The following is the password, which is encrypted by MD5.
After the file is created, put the file named. htpasswd at the location specified in the second row.
The second line of userfile takes a long time to complete. If the Error 500 is returned, the path is incorrect. The location of the atbhost space is/home/registration name.
The atbhost space provides the location for storing passwords:. htpasswds
Protect your. htaccess File
. Htaccess is too powerful, but will it be cracked? How can I protect it?
A: When you use. htaccess to set the password protection for a directory, it contains the path of the password file. In terms of security, it is necessary to protect. htaccess from being visible to others. Although this can be done in other ways, such as document permissions. However ,. htaccess can also be achieved by adding the following command: copy Code the code is as follows:
order allow, deny
deny from all