I have website (ASP MVC, hosted on IIS) old pages that I want to redirect but for some reason I don't get it right. I tried with IIS rewrite and with web.config too.
For example I have old page called https://www.tanalyzer.com/Home/FAQ and I want to redirect it to https://www.tanalyzer.com/faq
What I have in web.config is
<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" />
And for the rewrite map
<rewriteMap name="urls-old-to-new"><add key="/Home/FAQ" value="/faq"></rewriteMap>
ok i solved the issue
<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>
I now have 12 rules in web.config, is it too much?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.