【问题标题】:Windows ASP.NET redirectionWindows ASP.NET 重定向
【发布时间】:2012-11-07 21:02:02
【问题描述】:

我们有一些网站都通过一个 CMS 进行控制,即使它们有自己的域名。它们都托管在一个帐户下。

我想通过 web.config 在其中一个域上将默认页面设置为 index.html

例如,对于 abc.com,我希望它默认为 abc.com/index.html,但其他域保持原样。

虽然我可以将默认值设置为 index.html,但它似乎破坏了其他网站,因为它们每次都会重定向回这个网站。

【问题讨论】:

标签: asp.net redirect


【解决方案1】:

尝试使用location 元素包装重定向规则,并在path 属性中指定您的域。

更新
我认为应该是这样的:

<configuration>
...
<location path="http://abc.com">
  <system.webServer>
    <defaultDocument>
      <files>
        <clear />
        <add value="index.htm" />
      </files>
    </defaultDocument>
  </system.webServer>
</location>
...
</configuration>

【讨论】:

  • 不幸的是没有区别。转到 abc.com 会显示 index.html 文件,但转到 def.com 会显示相同的 index.html 文件
  • 好吧,你可以尝试用同样的方式为 def.com 指定defaultDocument,因为index.html 是Default.htm 和Default.asp(x) 之后的默认值之一。因此,如果您的目录中没有此类文件,它将被重定向到index.html。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-12-24
  • 2022-01-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-12-23
相关资源
最近更新 更多