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> |
|
# disable the server signature ServerSignature Off # limit file uploads to 10mb LimitRequestBody 10240000 |
|
<files config.php> order allow,deny deny from all </files> |
|
order allow,deny #deny from 000.000.000.000 allow from all |
|
# custom error docs ErrorDocument 404 /notfound.php ErrorDocument 403 /forbidden.php ErrorDocument 500 /error.php |
| Options All -Indexes |
| 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] |
|
#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] |
|
# php compression – use with caution <ifmodule mod_php4.c> php_value zlib.output_compression 16386 </ifmodule> |
|
# set the canonical url RewriteEngine On RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC] RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L] |
|
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] |
Sử dụng ftp client (sử dụng ASCII mode) và đổi tên file là .htaccess.
CHMOD file .htaccess sang 444.
4. OK
Không có nhận xét nào:
Đăng nhận xét