【发布时间】:2015-09-11 14:33:28
【问题描述】:
我正在尝试使用 web.config 进行重定向
如果网址是http://xyzsample.com,我想将其重定向到http://www.xyzsample.com
我试过下面的代码
<rule name="Imported Rule 1-1" enabled="true" stopProcessing="true">
<match url="^(*.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="xyzsample.com" />
</conditions>
<action type="Redirect" url="http://www.xyzsample.com/{R:1}" redirectType="Permanent" />
</rule>
但这不是重定向,而是导致500 internal server error
【问题讨论】:
-
匹配应该是
.*。详情请见here。
标签: c# asp.net redirect web-config