I see this is a big issue here and have read a lot of the posts but still haven't gotten it to work. Here is what I'v done so far. 1. Created a folder under my root "~/_subdomainFolder" 2. Created a sub domain using the "Sub Domain Manager" in the "Control Panel". "subdomain.mydomain.com" 3. Copied over the example app from MVC to "~/_subdomainFolder" and then used "Application Starting Point" to make it an application. 3. I use GoDaddy as my DNS manager so I added "subdomain" to point to my site IP. 4. Used IIS 7 to add a URL Rewrite rule. <rewrite> <rules> <rule name="SubDomainSite1" enabled="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAny"> <add input="{HTTP_POST}" pattern="^subdomain.comicsinventory.com$" /> </conditions> <action type="Rewrite" url="http://comicsin.w04.Winhost.com/_subdomainFolder/{R:1}" /> </rule> </rules> </rewrite> For some reason when I go to the url its still pointing to the root site. http://billingtest.comicsinventory.com It should show the example MVC app.
If you use the secondary url the example app is working fine. http://comicsin.w04.Winhost.com/_billing
The pattern is not being caught correctly. What is the exact name of your subdomain? Is it really subdomain.comicsinventory.com?
Set the pattern to ^billingtest.comicsinventory\.com$ Try that. If that still doesn't work keep the pattern ^billingtest.comicsinventory\.com$ but update the target to... /_subdomainFolder/{R:0} Let me know if that works.
New rewrite rules <rewrite> <rules> <rule name="BillingSite" enabled="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAny"> <add input="{HTTP_POST}" pattern="^billingtest.comicsinventory\.com$" /> </conditions> <action type="Rewrite" url="/_billing/{R:0}" /> </rule> </rules> </rewrite>
That should work. Not quite sure why its not. Try deleting the rule and starting again. Another way to do this is to simply code a redirect script on the startup page. http://support.Winhost.com/KB/a649/how-to-redirect-a-subdomain-to-a-subdirectory.aspx
Still nothing. Don't want to use a redirect because I want it to show up as billingtest.comicsinventory.com not the folder.
Shouldn't show in the HTTP Header where its being rewritten too? Doesn't even look like the rule is even running.
The http results shows that the call is not being redirected. I checked your account and you have several rules set in place. A couple set under the folder _billing. Lets try to make things simple for now. I really can't see why this doesn't work but who knows. I suggest you delete the URL rules under _billing and keep the one on the root for now. Also I can't help but think that _billing maybe messing with the rule. Can you change the folder name from _billing to just billing with out the "_" underline? You will need to make sure you modify the rule to match the folder.
Sorry about the other rewrites under "_billing", must of created them by accident, there gone now. Well I renamed "_billing" to "billing". I also updated the rewrite, deleted and created a new application, and recycled the app pool. Still nothing
I just checked IIS 7 and the new URL Rewrite module. It seems that {HTTP_POST} is no longer available. Try using {HTTP_HOST}