1.容許使用.htaccess html
打開httpd.conf(在那裏? APACHE目錄的CONF目錄裏面),用文本編纂器打開後,查找
(1)
Options FollowSymLinks
AllowOverride None
改成
Options FollowSymLinks
AllowOverride All
(2)去掉下面的註釋
LoadModule rewrite_module modules/mod_rewrite.sodom
2.配置404頁面ide
經常使用的客戶端哀求錯誤返回代碼:
401 Authorization Required
403 Forbidden
404 Not Found
405 Method Not Allowed
408 Request Timed Out
411 Content Length Required
412 Precondition Failed
413 Request Entity Too Long
414 Request URI Too Long
415 Unsupported Media Type 網站
ErrorDocument 錯誤代碼 /目錄名/名.擴展名 例如:ui
ErrorDocument 404 /errors/notfound.html
ErrorDocument 500 /errors/internalerror.html htm
3.拒絕個別ip或ip段訪問ip
order allow,deny
deny from 210.10.56.32
deny from 219.5.45.
allow from all
第二行拒絕某個IP,第三行拒絕某個IP段,也219.5.45.0~219.2.45.255 it
4.防止盜鏈
RewriteEngine on
RewriteCond %{ HTTP_REFERER } !^$
RewriteCond %{ HTTP_REFERER } !^http://(www.)?mydomain.com/.*$ [NC] #容許使用的網站
RewriteRule .(gif&line;jpg)$ - [F]
以爲讓別人的頁面開個天窗很差看,那用一張來代替:
RewriteEngine on
RewriteCond %{ HTTP_REFERER } !^$
RewriteCond %{ HTTP_REFERER } !^http://(www.)?mydomain.com/.*$ [NC]
RewriteRule .(gif&line;jpg)$ http://www.mydomain.com/替代名 [R,L] io