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>
</Limit>
Tạo file password với lệnh sau:
1 |
htpasswd -c /risktaker/.htpasswd dork <chú ý tên thư mục chưa file và tên user > |
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: http://www.osicodesinc.com/web/bbs/howto/htaccess.html
Vnfastweb.com
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:
|