apache 防盜鏈的第一種實現方法,可以用 rewrite 實現。首先要確認 apache 的 rewrite module 可用:能夠控制 apache httpd.conf 文件的,打開 httpd.conf,確保有這么一行配置:
- loadmodule rewrite_module modules/mod_rewrite.so
在找到自己網站對應的 配置的地方,加入下列代碼:
- servername Vevb.com
- # 防盜鏈配置
- rewriteengine on
- rewritecond %{http_referer} !^http://Vevb.com/.*$ [nc]
- rewritecond %{http_referer} !^http://Vevb.com$ [nc]
- rewritecond %{http_referer} !^http://www.49028c.com/.*$ [nc]
- rewritecond %{http_referer} !^http://www.49028c.com$ [nc]
- rewriterule .*.(gif|jpg|swf)$ http://www.49028c.com/about/nolink.png [r,nc]
新聞熱點
疑難解答