【问题标题】:Redirect or rewrite URL to new one重定向或重写 URL 到新的
【发布时间】:2017-08-17 13:53:19
【问题描述】:

我有想要重定向的网站(ASP MVC,托管在 IIS 上)旧页面,但由于某种原因我没有正确处理。我也尝试过使用 IIS 重写和 web.config。

例如,我有一个名为 https://www.tanalyzer.com/Home/FAQ 的旧页面,我想将其重定向到 https://www.tanalyzer.com/faq

我在 web.config 中拥有的是

<rule name="Rewrite rule1 for urls-old-to-new">
<match url=".*" />
<conditions>
<add input="{urls-old-to-new:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}" appendQueryString="false" />

对于重写地图

   <rewriteMap name="urls-old-to-new"><add key="/Home/FAQ" value="/faq"></rewriteMap>

【问题讨论】:

标签: c# iis model-view-controller


【解决方案1】:

好的,我解决了这个问题

        <rule name="FAQ" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="Home/FAQ$" />
      <conditions>
      </conditions>
      <action type="Redirect" url="https://www.tanalyzer.com/faq" redirectType="Permanent" />
    </rule>

我现在web.config里有12条规则,是不是太多了?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-04
    • 2012-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-01
    • 1970-01-01
    相关资源
    最近更新 更多