Apache 和 Nginx 图片以及资源防盗链
Apache防盗链:
在需要进行防盗链处理的目录,添加编辑 .htaccess 文件,文件内容为下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
RewriteEngine on #是否为直接访问资源 RewriteCond %{HTTP_REFERER} !^$ [NC] #检测 referer 地址 RewriteCond %{HTTP_REFERER} !lastme.com [NC] RewriteCond %{HTTP_REFERER} !themetouch.com [NC] #匹配如下的资源类型,如果不符合上述规则的则重定向到 www.themetouch.com/下的 forbidden.png RewriteRule .*\.(gif|jpg|jpeg|png|bmp|swf|ico|txt|doc|mp3|zip)$ http://www.themetouch.com/forbidden.png [R,NC,L] |
同理,nginx的图片防盗链规则也差不多:只需要在 nginx 配置文件的server段加入下面内容,或者写入一个公共文件里面在需要使用这个规则的配置里面引入即可,注意:一定要和 location 段同级:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico|txt|doc|mp3|zip)$ { access_log off; valid_referers none blocked *.lastme.com *.themetouch.com; if ($invalid_referer) { rewrite ^/ http://www.themetouch.com/forbidden.png; #return 403; } } |
有什么办法可以给wp文章内容页添加那种乱码,防止别人复制盗取!
防止盗取内容的话,对付电脑技术不高的人来说的话,可以禁用鼠标右键,可稍微有点技术的人来说,这些都不是问题,所以你说的这个,目前也没啥好的解决办法.