I’m trying to accomplish this using web.config and it worked fine when I had a default.aspx file but I’m using MVC and there’s no root .aspx file. How can I get it to go to my home controller and then the index view?
<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>
It was telling me that it cannot list the contents of the directory but that’s not what it should be trying to do anyway.
Did you see http://weblogs.asp.net/scottgu/archive/2010/04/20/tip-trick-fix-common-seo-problems-using-the-url-rewrite-extension.aspx this article?