How to point a subdomain to a sub folder using URL Rewrite?

Discussion in 'General troubleshooting' started by DonnyV, Sep 8, 2010.

  1. 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.
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    Try setting the target to...

    /_subdomainFolder/{R:1}
     
  3. Still nothing :(
     
  4. Last edited by a moderator: Oct 14, 2015
  5. Ray

    Ray

    The pattern is not being caught correctly. What is the exact name of your subdomain? Is it really subdomain.comicsinventory.com?
     
  6. Ray

    Ray

    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.
     
  7. Nothing on both counts :(
     
  8. Ray

    Ray

    Send us the updated portion of the URL Rule off your web.config file.
     
  9. 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>
     
  10. Ray

    Ray

    Can you quickly change the back slashes from

    /_billing/{R:0}

    to

    \_billing\{R:0}
     
  11. Nothing
     
  12. Ray

    Ray

    Last edited by a moderator: Oct 14, 2015
  13. Still nothing.

    Don't want to use a redirect because I want it to show up as
    billingtest.comicsinventory.com
    not the folder.
     
  14. Shouldn't show in the HTTP Header where its being rewritten too?
    Doesn't even look like the rule is even running.
    [​IMG]
     
  15. Ray

    Ray

    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.
     
  16. 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 :(
     
  17. Ray

    Ray

    I just checked IIS 7 and the new URL Rewrite module. It seems that {HTTP_POST} is no longer available. Try using {HTTP_HOST}
     
  18. HOLY SH*T!!

    That did it my friend :)

    You get a much deserved tweet.
     
  19. Nice!
     

Share This Page