已经在Windows服务器上设置了web.config文件,并且正在运行wine,因为它将非www重新路由到www和将http重新路由到https,但是我现在还需要添加一些旧的301重定向页面到其新的URL等效项。这就是我到目前为止所拥有的。
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<rewrite>
<rules>
<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^website.co.uk$" />
</conditions>
<action type="Redirect" url="https://www.website.co.uk/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
<directoryBrowse enabled="true" />
</system.webServer>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
</system.web>
</configuration>
所以我希望保持原样,但还要添加
<configuration>
<location path="https://www.website.co.uk/old-address/">
<system.webServer>
<httpRedirect enabled="true" destination="http://www.website.co.uk/new-address/" httpResponseStatus="Permanent" />
</system.webServer>
</location>
<location path="https://www.website.co.uk/services/">
<system.webServer>
<httpRedirect enabled="true" destination="https://www.website.co.uk/new-services/" httpResponseStatus="Permanent" />
</system.webServer>
</location>
</configuration>
,但是当我尝试在各个不同位置(忽略顶部和底部的配置)添加该文件时,我在该站点上仅收到500个错误,因此必须还原到顶部的有效web.config文件。我可以在哪里插入它,以便一切正常?
最感谢您的帮助。