Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Web config 使用web.config重定向特定ip范围_Web Config_Web.config Transform - Fatal编程技术网

Web config 使用web.config重定向特定ip范围

Web config 使用web.config重定向特定ip范围,web-config,web.config-transform,Web Config,Web.config Transform,我想使用web.config文件重定向特定的ip范围 我不熟悉web.config 这是我的密码 <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <clear /> <rule name="Redirect Jap

我想使用web.config文件重定向特定的ip范围

我不熟悉web.config

这是我的密码

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <clear />
            <rule name="Redirect Japan Users" stopProcessing="true">
                <match url=".*" />
                <conditions>
                    <add ipAddress="83.116.119.0" subnetMask="255.255.255.0"/>
                </conditions>
                <action type="Redirect" url="http://www.example.net/jp/" redirectType="Permanent" appendQueryString="false" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
</configuration>

试试这个:
//阻止特定IP
//将IP重定向到另一个域

谢谢@Vid。但是我想要一个ip范围,而不是特定的ip地址。
Try this:
//Block a particular IP
<security>
   <ipSecurity allowUnlisted="true">          
       <clear/>               
       <add ipAddress="IPTOBEBLOCKED"/>          
   </ipSecurity>
</security>

//Redirect an IP to another domain
<rule name="Redirect Japan Users" enabled="true" stopProcessing="false">
    <match url=".*" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="IPTOBEBLOCKED"/>
    </conditions>
    <action type="Redirect" url="http://www.example.net/jp/" redirectType="Permanent" appendQueryString="false" />
</rule>