Quản lý quyền truy cập thư mục với htaccess
Mã:
<directory đường_dẫn_folder>
#nội dung xử lý
</directory>
htaccess - chặn truy cập folder cụ thể:
Công thức chung cho việc chặn folder cụ thể như sau:
Mã:
<directory đường_dẫn_folder>
order allow,deny
deny from all
</directory>
Giải thích nội dung trên:
- <directory đường_dẫn_folder> trỏ tới folder cần xử lý
- order allow,deny: thứ tự ưu tiên theo deny trước, allow sau.
- deny from all: sẽ từ chối tất cả truy cập.
Ví dụ - chặn truy cập folder chứa file CGI:
Mã:
<directory "/var/www/cgi-bin/">
order allow,deny
deny from all
</directory>