locked
iis7 multiple domains leads to one single web site folder RRS feed

  • Question

  • User-715386769 posted

    I have one single web site or one single web application on my IIS7

    and i need multiple domains that will direct to to this single web application

    on the same physical path without creating more applications or virtual directorys.

    So how is it possible to configure IIS7 to direct multiple domains to the same web application?

    Tuesday, April 15, 2008 5:50 PM

Answers

  • User-1341446551 posted

    Hello,

    I am not very sure i understood your question properly... but here is my take on it ...

    go to the website in the IIS7 Manager right-click -->Edit Bindings --> and then Add the Bindings that you want ...

     

    hope this helps...  

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, April 16, 2008 8:49 AM
  • User-1341446551 posted

    No that's not possible ... Atleast I am not aware of it... ;)

     Anyways why would you want to do that ??? Just made all your bindings point to the same location... what's the point in doing that then... :)

    Although you can have a different default document for every VD or an App under the website... that is possible...
     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, April 16, 2008 7:34 PM

All replies

  • User-1341446551 posted

    Hello,

    I am not very sure i understood your question properly... but here is my take on it ...

    go to the website in the IIS7 Manager right-click -->Edit Bindings --> and then Add the Bindings that you want ...

     

    hope this helps...  

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, April 16, 2008 8:49 AM
  • User-715386769 posted

    yes it did halp and thanks a lot
    i was confused between application and web site and
    their relation to a host name(domain).
    your help me clear that and its seemes very simple.

    So let me meke it more challenging and ask:
    after i add multiple host names(domains) to single
    site through the "Edit Bindings" is it posible to define
    different default document for each?
    with the "Web.config" or "iis meneger" or any another way...

    thanks

    Wednesday, April 16, 2008 6:14 PM
  • User-1341446551 posted

    No that's not possible ... Atleast I am not aware of it... ;)

     Anyways why would you want to do that ??? Just made all your bindings point to the same location... what's the point in doing that then... :)

    Although you can have a different default document for every VD or an App under the website... that is possible...
     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, April 16, 2008 7:34 PM
  • User-715386769 posted

    I have built advanced web site sistem
    in one web solution in one folder with one Web.config file
    wich can have unlimited numbers of host names(domains)
    directing to it.

    every host name no meter if its a very big portal
    or smaller private site can have totaly different
    graphic design and contents.
     
    It took me years to develop this system and soon
    it going to be finished.
    It give me as a web builder meny big advantages.

    the problem is i need to have at least 2 default documents
    one for the users privates sites
    and one for my big portals.

    So lets say i add virtual directory or application
    under my web site for the private sites with different
    dafault document.
    how do i make a host name form the site bindings
    direct to this virtual directory or application
    and anather host name form the same site bindings
    direct to the web site?

    thanks i really appreciate your halp

    Thursday, April 17, 2008 3:41 AM
  • User-2064283741 posted

    I don't really understand your question still but I'll try and give you an answer. (and I'll speak in general terms moreso for older version of IIS)

    You have multiple domain host headers pointing to 1 site structure in IIS and from these domains you want redirect to seperate homepages, etc.

    I thought you could easily do this in config code.

    Everyone goes to the same page/config in there it looks up the

    I see this for many sites a few years ago where a client has Microsoft Content Management Server and Commerce Server. In the web.config it had a lookup for domain name that was entered and redirected this to the relevant subdirectory. e.g. mydomain.co.uk when to mydoamin.com/uk/default.htm

    It mayeb though I completely misunderstand you

    Thursday, April 17, 2008 9:21 AM
  • User-715386769 posted

    You did understand my question except:
    I have multiple domain host headers pointing to 1 site structure
    in IIS and from these domains i do not want to redirect to seperate homepages, etc.
    and i do not want redirected this to the relevant subdirectory.

    Is it possible without redirecting to determine a different
    default page for different domain host headers in one site?

    i have been told by ma_khan:
    i can have a different default document for every Virtual Directory
    or an Application under the website... 

    And so i asked:
    how do i make a host name form the site bindings
    leeds direct to virtual directory or application
    in a web site?

    thanks

    Thursday, April 17, 2008 10:05 AM
  • User-2064283741 posted

    So you want to goto different file location based on the host header entered but not redirect all under the same site?

    I am sorry but I don't understand why you want this.

    You can have lots of seperate sites in IIS all with the same directory structure and for all of those you can have a different default page. Why are you so against doing that?

    If you insist on have 1 site then you will have to, in code, redirect to the specfic homepage based on the domain like I said. Why do you not want to redirect?

    I don't understand how we could invent a system to do both or what real use it would have? It does exist in IIS 6 and I am pretty sure what you are after doesn't exist in IIS7.

    Thursday, April 17, 2008 10:20 AM
  • User-715386769 posted

    ok good i am not against that its a good solution.

    so i tryed and add 2 different web sites that lead to same physical directory
    the problam is each time i changed the default document for one
    it changed it to the other as well
    how do i determine a different default page for each one?

    Thursday, April 17, 2008 10:51 AM
  • User-2064283741 posted

    Ummh that doesn't work?!?

    it was something I have never tried having 2 websites the same paths but with different default docs.

    I have used multiple sites to the same path before but maybe the devs do something in the config to template it.

    Maybe you can only go code based then. I'll have a look later.

     

    Thursday, April 17, 2008 11:16 AM
  • User511787461 posted

    Please look at this

    Thursday, April 17, 2008 11:56 AM
  • User-1341446551 posted

    Anil thanks a lot for directing us to that post... really helpful and another good thing in IIS 7...

    However, a question... is the same thing also possible in previous versions of IIS ??

    Also,

    %windir%\system32\inetsrv\appcmd.exe set config "MySite1" -section:system.webServer/defaultDocument -+files.[value='newdoc.aspx'] -commitpath:apphost

    will add a default document tag in the system.webserver section ... But,

    How does IIS differentiate when to serve which default document ??? Because we here wanted the differentiator to be server bindings....

    Just curious... interesting topic... :)

    Thursday, April 17, 2008 1:29 PM
  • User511787461 posted

    You are specifying what config path you are configuring ("MySite1" in the example above) along with where to put the configuration (-commitpath:apphost) - since both sites share the same physical location, you need to not use distributed configuration to write this piece of configuration - since, previous IIS versions do not use distributed configuration, this is not an issue.

    Thursday, April 17, 2008 2:26 PM
  • User-715386769 posted

    Cen you please make it a littie more clear for me:

    from what i understand i need to open the commend prompt
    and write this command line:
    %windir%\system32\inetsrv\appcmd.exe set config "MySite1" -section:system.webServer/defaultDocument -+files.[value='newdoc.aspx'] -commitpath:apphost

    where:
    MySite1 - ? -is the name of my site in the iis7 ?
    newdoc.aspx - ? - is the default document ?
    commitpath - ? - is it the physical path to the site folder like c:\wwwrood\... ?
    apphost - ? - is it the domain name like: www.sitename.com ?

    thanks

    Thursday, April 17, 2008 3:50 PM
  • User-715386769 posted

    OK... I thing i understud :
    MySite1 - is the name of my site in the iis7
    newdoc.aspx - is the default document

    i have 2 site in my iis: advers and portals both lead to the same folder.

    After running the command line 2 times one for each site i
    get this code added at the bottom of the applicationHost.config:

    <location path="advers">
            <system.webServer>
                <defaultDocument>
                    <files>
                        <add value="newdoc.aspx" />
                    </files>
                </defaultDocument>
            </system.webServer>
        </location>
        <location path="portals">
            <system.webServer>
                <defaultDocument>
                    <files>
                        <add value="newdoc2.aspx" />
                    </files>
                </defaultDocument>
            </system.webServer>
        </location>

    the 2 line commaned was:
    %windir%\system32\inetsrv\appcmd.exe set config "advers" -section:system.webServer/defaultDocument -+files.[value='newdoc.aspx'] -commitpath:apphost
    %windir%\system32\inetsrv\appcmd.exe set config "portals" -section:system.webServer/defaultDocument -+files.[value='newdoc2.aspx'] -commitpath:apphost

    but still the same problam continue: both webs lead to the same default
    document: newdoc2.aspx
    what did i did wrong?
    is it bacase i test this on local machine and both sits have the same host header
    local host:127.0.0.1 even i stope one when i test the another?

    thanks

    Friday, April 18, 2008 2:09 AM
  • User511787461 posted

    Are you sure you are hitting the correct website?  You can verify using performance counters etc.

    Friday, April 18, 2008 2:41 PM
  • User-715386769 posted

    Yes i am sure - from the iis7 manager on the site name right click with
    the mouse > manage web site > browse

    it seems because both web site heve the same web.config fille
    what appear with him for example in my case:
    <defaultDocument enabled="true">
            <files>
                <clear />
                <add value="newdoc2.aspx" />
                <add value="newdoc.aspx" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="iisstart.htm" />
                <add value="default.aspx" />
            </files>
        </defaultDocument>

    is what the iis7 consider and not the new applicationHost.config
    configuration.

    So the question is how to make the iis7 use the new applicationHost.config
    configuration and not the web.config configuration? 

    Friday, April 18, 2008 4:33 PM
  • User511787461 posted

    Remove the relevant configuration from web.config

    Friday, April 18, 2008 5:06 PM
  • User-715386769 posted

    you are a king!!

    finally working!!

    definitely was worth the effort

    really thanks a lot!!

    cheinan

    Friday, April 18, 2008 5:44 PM
  • User1016958968 posted
    Hi, I have a similar issue- but it requires a Virtual Directory, for reasons that are irrelevant to the discussion. I want to add a default document incorporating a querystring to the VirDir, but IIS7 won't let me. Can I use a similar technique to the above? If you put it in the web.config file, it complains that it's not "well-formed XML".
    Monday, June 25, 2012 12:35 PM