. htaccess htaccess File Protection examples explained

Source: Internet
Author: User
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.

  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.