将URL重定向或重写为新URL

时间:2017-08-17 13:53:20

标签: c# iis model-view-controller

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

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

我在web.config中的内容是

for counter in range(10):
    print(counter)

对于重写地图

<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" />

1 个答案:

答案 0 :(得分:0)

好吧我解决了这个问题

        <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个规则,是不是太多了?