Description of. htaccess file protection instance

Source: Internet
Author: User
Tags password protection

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

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.