Redirect IIS默认网站根据域名有条件重定向

Redirect IIS默认网站根据域名有条件重定向,redirect,iis,web-config,iis-8,Redirect,Iis,Web Config,Iis 8,我有许多网站托管在同一个IIS上。当我停止其中一个并尝试访问它时,它会呈现IIS的默认网站。i、 eiisstart.htm 我需要的是,例如,当example1.com被停止并试图访问其主页或更好的任何URL时,即example1.com/some/path它会重定向到默认网站根目录下的其他已定义页面,如example1.html。此外,我需要尽可能多地应用解决方案,例如example2.com,example3.com等等 我尝试了以下web.config设置,但不起作用: <?xml

我有许多网站托管在同一个IIS上。当我停止其中一个并尝试访问它时,它会呈现IIS的默认网站。i、 e
iisstart.htm

我需要的是,例如,当
example1.com
被停止并试图访问其主页或更好的任何URL时,即
example1.com/some/path
它会重定向到默认网站根目录下的其他已定义页面,如
example1.html
。此外,我需要尽可能多地应用解决方案,例如
example2.com
example3.com
等等

我尝试了以下
web.config
设置,但不起作用:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>

            <rules>
                <rule name="conditional products redirect" enabled="true"> 
  <match url="^example1(.*)" ignoreCase="true" /> 
  <conditions> 
    <add input="{HTTP_HOST}" pattern="/example1.html" /> 
  </conditions> 
  <action type="Redirect" url="/example1.html" appendQueryString="false" redirectType="Found" /> 
</rule> 
            </rules>
        </rewrite>
    </system.webServer>
</configuration>


HTTP主机名行完全错误。@LexLi如何修复它?我对IIS配置了解不够。我有一些资料,但你可以从互联网上现有的示例中学习。