August 18th, 2009
มาป้องกัน IndexOption ด้วยพาสเวิร์ดดีกว่า
No Comments », Linux, Other, by nolifelover
หลังจากที่ทำ IndexOption ด้วย htaccess แล้วเราอยากปกป้อง directory บางอันไหม หากต้องการทำตามนี้เลย ซึ่งการทำจะใช้งาน .htaccess เหมือนเดิมและจะเพิ่มในส่วนของ .htpasswd มาเพื่อใช้ในการเข้าสู่ระบบ
วิธีการทำ
1. ไปยัง folder ที่ต้องการป้องกันด้วยรหัสผ่าน
2. สร้างไฟล์ .htaccess
เพิ่ม code ต่อไปนี้
AuthType Basic
AuthName "Yun Trade File Repositories"
AuthUserFile ที่อยู่เต็ม #ex /home/nolifelover/public_html/.htpasswd
Require valid-user
3. สร้างไฟล์ .htpasswd โดยใช้งาน http://www.htaccesstools.com/htpasswd-generator/ เข้ามาช่วยก็ไปใช้จากนั้นเอา output มาใส่ในไฟ์ .htpasswd ก็จะได้ระบบป้องกันไดเรกทอรี่นี้แล้ว
เพิ่มเติม
http://httpd.apache.org/docs/1.3/howto/auth.html
http://www.htaccesstools.com/htpasswd-generator/
18 views
