其实就是Apache,支持.htaccess规则,所以挺好办的:
# 开启URL重写引擎(必须)
RewriteEngine On
# 开启重写日志(调试用,上线可注释)
# RewriteLog "/var/log/apache2/rewrite.log"
# RewriteLogLevel 3
# 图片防盗链核心规则
# 规则1:排除空Referer(允许直接在浏览器访问图片)
RewriteCond %{HTTP_REFERER} !^$ [NC]
# 规则2:排除白名单域名(jd.com所有子域名、qq.com所有子域名)
RewriteCond %{HTTP_REFERER} !^https?://([a-zA-Z0-9-]+\.)*rei3\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^https?://([a-zA-Z0-9-]+\.)*nervcn\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^https?://([a-zA-Z0-9-]+\.)*imsyou\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^https?://([a-zA-Z0-9-]+\.)*mgrei\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^https?://([a-zA-Z0-9-]+\.)*moliclub\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^https?://([a-zA-Z0-9-]+\.)*qq\.com/ [NC]
# 规则3:匹配需要保护的图片格式
RewriteRule \.(jpeg|jpg|gif|webp|png|bmp|svg)$ - [F,L,NC]



















没有回复内容