


方法
以下代码均在站点配置文件添加即可!
1、屏蔽部分网站和IP
意思是屏蔽那些网站或IP段的外链请求,并且替换图片为https://blog.tag.gg/logo.png,为何还要屏蔽IP段呢? 因为好多大人网站会直接采用IP地址访问,所以加上了这个匹配规则。if ($http_referer ~* abcd.com|bcde.org|cdef.me|103.35.13.4|235.35.3.2)
{
rewrite ^/ https://blog.tag.gg/logo.png;
}
2、设置部分网站跳转
可以将以上的网址访问过来链接自动跳转到https://blog.tag.gg上,其他网站外链过来的话连接不变,这样可以把一部分访问量很大的网站流量转移到其他服务器上。if ($http_referer ~* abcd.com|bcde.org|cdef.me)
{
rewrite ^(.*)$ https://blog.tag.gg$1 permanent;
}
3、设置部分文件夹跳转
把picture目录下所有的文件转向到https://blog.tag.gg/picture/目录下,其他具体的应用需要根据自己的网站来设置吧。if ($http_referer ~* abcd.com|bcde.org|cdef.me)
{
rewrite ^/picture/(.*)$ https://blog.tag.gg/picture/$1 permanent;
}



亲爱的:若该文章解决了您的问题,可否收藏+评论+分享呢?
文章评论 本文章有个评论