Sử dụng file .htaccess để tối ưu và bảo mật website của bạn hơn: bảo vệ các file quan trọng, giới hạn upload, chuyển hướng 301, trang lỗi tùy chỉnh, tắt liệt kê nội dung thư mục, nén nội dung...Chức năng:
1. Bảo vệ tệp tin
2. Tắt chữ ký số của web server
3. Giới hạn upload
5. Giới hạn quyền truy cập
6. Trang lỗi tùy chỉnh
7. Tắt liệt kê nội dung thư mục
8. Chuyển hướng 301
9. Chống ăn cắp băng thông như hình ảnh, video (bandwidth)
10. Bật nén PHP compression (bandwidth)
11. Thiết lập canonical url cho website
1.Bước 1, Tạo file .htaccess.
Mở Notepad hoặc phần mềm text editor. Lưu và Đặt tên file htaccess.txt.
2. Nhập nội dung vào file htaccess.txt.
# Bảo vệ file file htaccess
<files .htaccess>
order allow,deny
deny from all
</files>
#Tắt chữ ký số của web server
# disable the server signature
ServerSignature Off
# limit file uploads to 10mb
LimitRequestBody 10240000
# Bảo vệ file cấu hình config.php
<files config.php>
order allow,deny
deny from all
</files>
# Giới hạn truy cập, chặn IP
order allow,deny
#deny from 000.000.000.000
allow from all
# Tạo Trang lỗi tùy chỉnh
# custom error docs
ErrorDocument 404 /notfound.php
ErrorDocument 403 /forbidden.php
ErrorDocument 500 /error.php
# Tắt liệt kê nội dung thư mục
Options All -Indexes
# Chuyển hướng 301
Redirect 301 /old.php http://www.yourdomain.com/new.php
# Khóa tên miền tham chiếu
RewriteEngine on
RewriteCond %{HTTP_REFERER} digg.com [NC]
RewriteRule .* - [F]
Chống ăn cắp băng thông
#disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?yourdomain.com/.*$ [NC]
#RewriteRule .(gif|jpg)$ - [F]
#RewriteRule .(gif|jpg)$ http://www.yourdomain.com/stealingisbad.gif [R,L]
Nén file
# php compression - use with caution
<ifmodule mod_php4.c>
php_value zlib.output_compression 16386
</ifmodule>
Tránh trùng lặp nội dung
# set the canonical url
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
# Chống spam comments
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .comments-post.php*
RewriteCond %{HTTP_REFERER} !.*yourdomain.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
3. Upload htaccess.txt lên server.
Sử dụng ftp client (sử dụng ASCII mode) và đổi tên file là .htaccess.
CHMOD file .htaccess sang 644.
Danh mục
- 18 Khách hàng đánh giá tốt
Related Articles
Một số phương pháp bảo mật website joomla
Xây dựng website đã là khó. Để duy trì và phát triển nó lại càng khó hơn. Và bảo mật cho nó thì...
Bảo mật cho trang quản trị Joomla bằng mật khẩu
Bạn muốn ngăn chặn việc truy cập trái phép vào vùng quản trị, trang administrator (phần backend...
Lấy lại password Joomla administrator
Đôi khi, do bị hack, hoặc chỉ lỡ tay thay đổi password mà bạn quên mất không nhớ password mới set...
Chèn trạng thái Online/Offline yahoo trên website bằng hình ảnh khác
Chúng tôi xin giới thiệu công cụ check nick yahoo cho các webmaster với mục đích thay đổi hình...
Các phương thức sao lưu cơ sở dữ liệu
Bạn có thể dùng các phương thức sau để sao lưu cơ sở dữ liệu:Phương thức 1. Sử dụng mysqldump....
Từ khóa tìm
thanh toan
tai khoan ngan hang
ho tro
lien he
nap tien
tai khoan
nang cap
nang cap dich vu
tuy chinh dich vu
hoan tien
dich vu
ten mien
ten mien viet nam
phap luat
bao ve
giam gia
wordpress
sua loi
khac phuc
sypex
restore
backup
huong dan
mysql
directadmin
toi uu
bang gia ten mien
hosting gia re
hosting
chat luong
viet nam
web hosting
datacenter
tai tro
hosting mien phi
may chu
may chu ao
vps
da nang
cho thue vps
thiet ke
hosting viet nam
whmcs
thiet ke web
reseller
email
dich vu email
email ten mien
chung chi ssl
cai dat ssl
phien ban PHP
php version
php code
loi php
Hosting Da Nang
VPS Da Nang
cloud vps
cloud server
dich vu vps
website
proxy
dich vu proxy
cach dung proxy
proxy viet nam
may chu ao da nang
vps cloud
vietcombank
techcombank
mbbank
momo
thanh toan dich vu
chinh sach
