.htaccess如何设置防盗链某个目录的图片

时间:2021-03-16 11:04:42

防止排除一些网站盗链某个目录的图片:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_REFERER} !^$ [NC]
RewriteCond %{HTTP_REFERER} !google.com [NC]
RewriteCond %{HTTP_REFERER} !baidu.com [NC]
RewriteCond %{HTTP_REFERER} !sogou.com [NC]
RewriteCond %{HTTP_REFERER} !soso.com [NC]
RewriteCond %{HTTP_REFERER} !youdao.com [NC]
RewriteCond %{HTTP_REFERER} !yahoo.cn [NC]
RewriteRule ^uploadfiles/(.*)\.(gif|jpg|png)$ http://www.aoyou0898.com/images/change.gif [L]

主要就是排除搜索引擎