Multiple sites, domains and subdomains

Discussion in 'General troubleshooting' started by mamona, Apr 24, 2010.

  1. Thanks to this forum I solved my problems with hosting multiple websites using URL Rewrite. The only thing is, each of them has its own domain, everything is fine. But when I want to add subdomain, I get only index.html displayed. All images, css are lost. Any ideas how to get this working properly?
    Even path http://SubdomainSite1.site1.com/images/logo.png displays index page. :confused:
    I setup 4 Application starting points following instructions here http://blog.benpowell.co.uk/2010/02/Winhostcom-how-to-really-run-multiple.html

    * /
    * /Site1
    * /Site2
    * /SubdomainSite1

    And my web.config
    Code:
            <rewrite>
                <rules>
                    <rule name="site1.com">
                        <match url="(.*)" />
                        <conditions>
                            <add input="{HTTP_HOST}" pattern="(www.)?site1.com" />
                            <add input="{PATH_INFO}" negate="true" pattern="^/site1/" />
                        </conditions>
                        <action type="Rewrite" url="\site1\{R:0}" />
                    </rule>
                    <rule name="site2.com">
                        <match url="(.*)" />
                        <conditions>
                            <add input="{HTTP_HOST}" pattern="(www.)?site2.com" />
                            <add input="{PATH_INFO}" negate="true" pattern="^/site2/" />
                        </conditions>
                        <action type="Rewrite" url="\site2\{R:0}" />
                    </rule>
                    <rule name="subdomain.site1.com">
                        <match url="(.*)" />
                        <conditions>
                            <add input="{HTTP_HOST}" pattern="^subdomain.site1.com" />
                            <add input="{PATH_INFO}" negate="true" pattern="^/subdomainSite1/" />
                        </conditions>
                        <action type="Rewrite" url="subdomainSite1\" />
                    </rule>
                </rules>
            </rewrite>
    
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    I'm not quite sure I understand what you are trying to say...

    "But when I want to add subdomain, I get only index.html displayed"

    Do you mean that your subdomain name is reverting back to the root?

    If that is the case then yes that is correct, that is how subdomains will work. They work like domain pointers where teh initial starting point is in the root, so you'll need to setup there own URL Redirect rule just like you did for your domain pointer.
     

Share This Page