I need to setup some 301 permanent redirects in the web.config of an ASP.NET MVC application running under IIS.
The easiest way is to add a tag similar to the one below to the web.config file:
<location path="TheMenu.aspx">
<system.webServer>
<httpRedirect enabled="true" destination="menus/" httpResponseStatus="Permanent" />
</system.webServer>
</location>
When I go to the site at http://domain.com/TheMenu.aspx
it redirects me to http://domain.com/menusxd
instead of http://domain.com/menus
.
What would be 开发者_开发知识库causing this?
Sorry I can't help you with <httpRedirect>
but have you tried / can you use the IIS7 URL Rewrite module?
Your rule would look something like:
<system.webServer>
<rewrite>
<rules>
<rule name="TheMenu" patternSyntax="Wildcard" stopProcessing="true">
<match url="TheMenu.aspx" />
<action type="Redirect" url="menus/" />
</rule>
</rules>
</rewrite>
</system.webServer>
HTHs,
Charles
精彩评论