阿里虚拟主机如何web.config屏蔽IP地址访问?出现HTTP错误500.19无法访问请求的页面数据无效.

图片描述

图片描述

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.webServer>
        <defaultDocument>
            <files>
            <clear />
                <add value="index.html" />
                <add value="index.asp" />
            </files>
        </defaultDocument>
           <httpErrors errorMode="DetailedLocalOnly">
           <remove statusCode="404"/>
           <error statusCode="404" path="/404.asp" responseMode="ExecuteURL"/>
           </httpErrors> 
         
            <rewrite>
                <rules>
                <rule name="WWW Redirect" stopProcessing="true">
                <match url=".*" />
                <conditions>
                <add input="{HTTP_HOST}" pattern="^baidu.com$" />
                </conditions>
                <action type="Redirect" url="http://www.baidu.com/{R:0}"  redirectType="Permanent" />
                </rule>

                <rule name="band ip" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="%{HTTP_X_FORWARDED_FOR}&%{REMOTE_ADDR}" pattern="(8.8.4.4|8.8.8.)" />   
                    </conditions>
                    <action type="AbortRequest" />
                </rule>
            </rules>
        </rewrite>
     
      <directoryBrowse enabled="false" />
 </system.webServer>
</configuration>
阅读 2.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题