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
The line is not much explanation, the key is the second row, must be absolute path, indicating the location of the. htpasswd file. (Location arbitrary)
Then put the file named. htaccess in the Admin folder.
Step two, the following is a new file named. htpasswd, the name should be the same as the second line above.
Simple method: Start-run-cmd-apache>bin\htpasswd-c. htpasswd Name
The following is the input password, is MD5 encrypted.
When you are done, place the file named. htpasswd on the second line at the specified location.
Again userfile second line, it took me a long time to fix, if the prompt 500 error is the path is incorrect. The location for the Atbhost space is the/home/registered name.
Atbhost Space provides a place to store passwords:. Htpasswds
Protect your. htaccess files
Htaccess is too strong, but it will not be cracked itself, 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 safety point of view, it is necessary to protect the. htaccess from being seen. Although this can be done in other ways, such as permissions on a document. However, the. htaccess itself can do so by simply adding the following instructions:
Copy the Code code as follows:
Order Allow,deny
Deny from all
The above describes the. htaccess htaccess File Protection examples, including the. htaccess aspect of the content, want to be interested in PHP tutorial friends helpful.