Directory Authentication thông qua .htaccess

Tạo file tại thư mục muốn đặt Authentication với nội dung như sau:

The .htaccess file

    AuthUserFile /risktaker/.htpasswd  <nơi chứa file password>
    AuthGroupFile /dev/null
    AuthName dork <tên user access>
    AuthType Basic
    <Limit GET>
    require user dork <tên user đc phép access>

Tạo file password với lệnh sau:

Sau khi tạo xong file .htpasswd cần chown file này để có thể access – read file này.

chi tiết xem thêm tại đây:

The Password File

Once I finished with .htaccess, I created the password file. As I mentioned before, the password file must be stored in another directory so users can’t access it. This means, of course, that you shouldn’t store it in just any old directory on your site – in other words, it shouldn’t be Web accessible. The directory where you keep your Web server configuration files is a good place.

You can create the password file like this:

Leave a Reply

Your email address will not be published.