Optimize your website and in file security. Htaccess

Dienstag, 27. Mai 2014
Use file. Htaccess to optimize and secure your website more: protect important files, upload limit, 301 redirects, custom error pages, listed off the directory contents, the contents ...
Use file. Htaccess to optimize and secure your website more: protect important files, upload limit, 301 redirects, custom error pages, listed off the directory contents, the contents ...
Actions: 
1. Guard file 
2. Deactivating the web server's digital signature 
3. Limited to one 
5. Restrict access 
6. Custom error page 
7. T AT lists directory contents 
8. 301 Redirect 
9. Chong stealing bandwidth as images, video (bandwidth) 
10. Laid the PHP compression (bandwidth) 
11. Canonical url Setup for website 

1. The Step 1 Create a file. Htaccess. 
Open Notepad or a text editor software. Save and name the file htaccess.txt. 
2. Entered content htaccess.txt file. 

# Protect files htaccess file 
<files .htaccess> 
order allow, deny 
deny from all 
</ Files> 
# Disable the web server's digital signature 
# Disable the server signature 
ServerSignature Off 
# Limit file uploads to 10mb 
LimitRequestBody 10240000 
# Guard config.php 
<files config.php> 
order allow, deny 
deny from all 
</ Files> 
# Restrict access, IP blocks 
order allow, deny 
# Deny from 000.000.000.000 
allow from all 
# Create custom error pages 

# Custom error docs 
ErrorDocument 404 / notfound.php 
ErrorDocument 403 / forbidden.php 
ErrorDocument 500 / error.php 
# Disable directory contents listed 
Options All-Indexes 
# 301 Redirect 
Redirect 301 / old.php http://www.yourdomain.com/new.php 
# Faculty referral domains 
RewriteEngine on 
RewriteCond% {HTTP_REFERER} digg.com [NC] 
RewriteRule. * - [F] 
Anti-steal bandwidth 

# 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] 
Compress files 

# Php compression - use with caution 
<IfModule mod_php4.c> 
php_value zlib.output_compression 16 386 
</ IfModule> 
Avoid Duplicate Content 

# Set the canonical url 
RewriteEngine On 
RewriteCond% {HTTP_HOST} ^ yourdomain.com $ [NC] 
RewriteRule ^ (. *) $ Http://www.yourdomain.com/ $ 1 [R = 301, L] 
# Anti 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 to the server. 
Use ftp client (using ASCII mode) and change the file name is. Htaccess. 
CHMOD file. Htaccess to 644.
Chia sẻ bài viết ^^
Other post

All comments [ 0 ]


Your comments