Loading
0

IIS7/IIS8/IIS10web.config中禁止目录运行脚本方法
被墙跳转TG:@qianhenetwork QQ 851617266

301免备案跳转微信公众号
腾讯云服务器大促销。
华为服务器
前言:IIS7/IIS8/IIS10中需要禁止目录运行脚本,可以在web.config中添加规则来实现,本教程将介绍在web.config中添加规则实现某目录禁止执行脚本,以php脚本为例,若是其他脚本,请修改。
若有多个目录,请复制<rule name="Block a" stopProcessing="true"> </rule> 代码块,并改为自己的信息即可
 

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Block a" stopProcessing="true">
                    <match url="^a/(.*).php$" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{USER_AGENT}" pattern="a" />
                        <add input="{REMOTE_ADDR}" pattern="" />
                    </conditions>
                    <action type="AbortRequest" />
                </rule>
                <rule name="Block data" stopProcessing="true">
                    <match url="^data/(.*).php$" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{USER_AGENT}" pattern="data" />
                        <add input="{REMOTE_ADDR}" pattern="" />
                    </conditions>
                    <action type="AbortRequest" />
                </rule>
                <rule name="Block skin" stopProcessing="true">
                    <match url="^skin/(.*).php$" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{USER_AGENT}" pattern="skin" />
                        <add input="{REMOTE_ADDR}" pattern="" />
                    </conditions>
                    <action type="AbortRequest" />
                </rule>

            </rules>
        </rewrite>
    </system.webServer>
</configuration>

301免备案跳转微信公众号
华为服务器
腾讯云服务器大促销。

声明:站长码字很辛苦啊,转载时请保留本声明及附带文章链接:https://www.zfcdn.xyz/showinfo-8-36182-0.html
亲爱的:被墙域名跳转TG:@qianhenetwork QQ:851617266,可否收藏+评论+分享呢?
上一篇:解决IIS10“Url重写工具2.0”安装失败,此产品安装失败,已下载的文件未通过签名验证,并且可能已被篡改方法
下一篇:Windows系统手动在IIS中搭建FTP详细步骤