【发布时间】:2016-10-17 15:42:22
【问题描述】:
我正在尝试使用 Url Rewrite 将旧站点 url 重定向到新站点,并将 url 放在单独的文件中。理想情况下,我希望捕获所有 http 和 https 请求。这就是我的 web.config 中的内容。
<rewrite>
<rewriteMaps configSource="rewritemaps.config" />
<rules>
<rule name="Redirect oldsite.com to newsite.com" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.oldsite.com$" />
</conditions>
<action type="Redirect" url="https://www.newsite.com" redirectType="Permanent" appendQueryString="false" />
</rule>
</rules>
</rewrite>
在我的 rewritemaps.config 文件中
<rewriteMaps>
<rewriteMap name="Redirects">
<add key="/~woodburningstove/index.php/contacts/" value="/ContactUs" />
<add key="/about-us" value="/about-us-2" />
<add key="/blog" value="/blog" />
<add key="/brands" value="/manufacturer/all" />
<add key="/brands/herald" value="/herald-stoves" />
<add key="/brands/stovax" value="/stovax-stoves" />
<add key="/brands/town-country" value="/town-country-fires"/>
<add key="/brands/warmglow" value="/warmglow-stoves"/>
<add key="/brands/warmglow/warmglow-4-cast-iron-stove-flat-black-paint-finish" value="/warmglow-4-black-2"/>
<add key="/brands/warmglow/warmglow-7-cast-iron-stove-flat-black-paint-finish" value="/warmglow-7-cast-iron-black"/>
<add key="/brands/warmglow/warmglow-7-cast-iron-stove-flat-ivory-enamel" value="/warmglow-7-cast-iron-ivory-enamel"/>
<add key="/brands/warmglow/warmglow-7-cast-iron-stove-flat-metallic-black-enamel" value="/warmglow-7-cast-iron-metallic-black-enamel"/>
<add key="/brands/warmglow/warmglow-7-cast-iron-stove-flat-metallic-black-enamel" value="/warmglow-7-cast-iron-metallic-black-enamel"/>
</rewriteMap>
</rewriteMaps>
但是我不断收到“页面无法显示,因为发生了内部服务器错误”,但我无法发现我做错了什么!?
【问题讨论】:
标签: azure redirect iis web-config