ASP.NET MVC重定向非WWW到WWW并重写为小写URL
问题描述:
我想完成这个使用web.config和它工作正常,当我有一个default.aspx文件,但我使用MVC,并没有根.aspx文件。我怎么能得到它去我的家庭控制器,然后索引视图?ASP.NET MVC重定向非WWW到WWW并重写为小写URL
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^mydomain.com$" />
</conditions>
<action type="Redirect" url="http://www.mydomain.com/{R:0}"
redirectType="Permanent" />
</rule>
<rule name="convert to lower case" stopProcessing="false">
<match url=".*[A-Z].*" ignoreCase="false"/>
<conditions>
<!-- The following condition prevents rule from rewriting requests to .axd files -->
<add input="{URL}" negate="true" pattern="\.axd$"/>
</conditions>
<action type="Redirect" url="{toLower:{R:0}}" redirectType="Permanent"/>
</rule>
</rules>
</rewrite>
<directoryBrowse enabled="false" />
</system.webServer>
有人告诉我,它不能列出目录的内容,但是这不是它应该尝试无论如何做。
我只是这样做,这是我在那里几乎相同的东西。我重新发布了它,现在它可以工作...去图。 – 2012-02-27 23:34:11
我会把这个标记为答案,因为它在这里还有其他一些东西可以用在我身上。感谢那。 – 2012-02-27 23:35:10