源码论坛

 找回密码
 立即注册
特价微空间价格表香港标准空间价格表高防攻击空间价格表金牌高防空间价格表

IIS网站文件图片防盗链设置教程

[复制链接]
发表于 2024-1-12 10:43:47 | 显示全部楼层 |阅读模式
首先IIS需要安装伪静态组件URL Rewrite,然后将代码保存为web.config,修改其中允许调用的域名,把它存放到网站根目录中,即可生效。



<?xml version="1.0" encoding="UTF-8"?>

<configuration>

<system.webServer>

<rewrite>

<rules>

<rule name="Prevent hotlinking">

<match url="^.*\.(jpg|png|mp4|rar|zip)$" ignoreCase="true" />

<conditions>

<add input="{HTTP_REFERER}" pattern="http://允许外部调用的域名/.*" negate="true" />

<add input="{HTTP_REFERER}" pattern="http://绑定的域名/.*" negate="true" />

</conditions>

<action type="Rewrite" url="/404.htm" />

</rule>

</rules>

</rewrite>

</system.webServer>

</configuration>

网站源码香港空间 http://cy0575.cn,咨询请联系微信和QQ:80561642,微店 | 淘宝店|空间主机价格表|选择香港空间
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



QQ|论坛首页|空间首页|标准空间|高防空间|微空间|金牌空间|手机版|源码论坛

全屏模式

GMT+8, 2024-5-19 10:48

Powered by CY0575.cn YM0571.cnX3.5

快速回复 返回顶部 返回列表