【发布时间】:2014-04-11 15:14:50
【问题描述】:
我有运行 IIS 的 W2008,并且有大约 20 个网站(全部是 PHP,大约一半是 WP)在上面运行。
目前我在几个网站的标题中都有这个,它正在工作。但它越来越难以管理,因为即使我是管理员,也有很多开发人员,如果他们愿意,他们可以在大多数网站上覆盖标题。
<!--[if IE 8]>
<script type="text/javascript">
window.location = "http://example.com/wedontsupportIE8.html";
</script>
<![endif]-->
有没有办法在服务器上设置具有相同功能的规则?
补充说明:
我在网络服务器上添加了规则,但它们基本上不能正常工作。在过去的 6 个月里,我已经重定向到 /home/index.php。当我首先添加新规则时,它会执行以下操作:
- 在 IE8 中 - 站点上任何目录的 404 错误并恢复到根目录
- 在 IE10、FF、Chrome、Safari 中 - 它只是按照应有的方式重定向到 /home。
下面的webconfig
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="IE8rewriteall" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{HTTP_USER_AGENT}" pattern="*MSIE*" />
</conditions>
<action type="Rewrite" url="http://example.com/ie/index.html" />
</rule>
<rule name="Root Hit Redirect" stopProcessing="true">
<match url="^$" />
<action type="Redirect" url="/home/index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
【问题讨论】:
-
将他们重定向到不同的站点是一种不好的做法。您最好将其保留在客户端(通过 javascript),而不是重定向实际上用 div 覆盖屏幕,然后是升级浏览器的链接。
-
@Frank - 我同意,但这只是一个大型 Intranet 站点,而这正是他们想要的。重定向有升级链接和不同的浏览器可供选择。
标签: windows redirect iis-7 internet-explorer-8