我正在尝试从 domain.net 重定向到 www.domain.net。但是,我得到的只是 IIS 404 错误页面。
我的网络配置看起来像这样。但即使是 http 错误声明也被忽略了,我只得到 IIS 的 404 页面,而不是我指定的文件。
<system.webServer>
<httpErrors errorMode="Custom" defaultPath="/404.html" defaultResponseMode="Redirect" existingResponse="Replace"/>
<rewrite>
<rules>
<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^mylifelessons.net$" />
</conditions>
<action type="Redirect" url="http://www.mylifelessons.net/{R:0}"
redirectType="Permanent" />
</rule>
</rules>
</rewrite>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule" />
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" preCondition="managedHandler" />
</modules>
<handlers>
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>