Godaddy subdomain url rewriting


Adding a subdomain to a hosting account with Godaddy creates a folder within the hosting root.  By default, this folder is named the same as the subdomain, but it is editable.  The issue lies within the fact that if you reference the folder, without the subdomain, you get the same site.  Therefore, navigating to,, or all yield the same result.  The… address is displayed when the user navigates from the subdomain’s homepage.   This can cause issues for an MVC application which is looking for specific “folders” for routing.


Add the following section to the site’s web.config file.

    <rule name="Remove Virtual Directory">
      <match url=".*" />
      <action type="Rewrite" url="{R:0}" />

All this does is “rewrite” the URL with itself. This causes URL Rewrite to add the original URL (the one with no folder name) to a ServerVariable which is used by ASP.NET MVC to generate other URLs.

This hack shamelessly stolen from Godaddy’s support forums:

Posted on November 23, 2011 at 8:09 am by Steve Konves · Permalink
In: ASP.Net MVC, C#

Leave a Reply