Need help setting up 2 websites under 1 account

Discussion in 'Windows / IIS' started by Underworld, Dec 3, 2009.

  1. Hi there -

    This is frustrating me! I want to run two websites from my one account.

    I'm not sure if im taking the wrong approach but - I've been trying to create two directories and place my two websites under these directories. Then I was trying to do an IIS7 URL re-write but nothing seems to work.

    Am I taking the right direction? Is there any documentation for getting this to work?

    Surely some one out there has two websites running under the same hosting!

    Thanks!

    Update: I'm wondering whether the URLReWrite actually works - I've tried doing a basic re-write and a basic redirect, none of them actually happen.
     
  2. OK - ive settled for writing a Global.asax that redirects the request. (Couldnt get the HTTPModule to take).

    The only sucky thing is that my website looks like this:

    In a browser make a call to my domain:

    www.mydomain.com
    or
    www.myotherdomain.com

    It now goes to

    www.mydomain.com/Folder1
    www.myotherdomain.com/Folder2 respectively.

    Where my website is structured like this:

    Website
    + Folder1
    + Folder2

    Is the only way to get around the annoying folder to do some URL Re-writing?
    If so - i didnt have any luck in IIS Url rewriter, it never seemed to do anythinig.
     
  3. First, set the folders as application starting points using the Web Application tool in the DiscountASP control panel.

    Then insert this rewrite rule in the root web.config:

    Code:
    <configuration>
        <system.webServer>
    
    <rewrite>
      <rules>
        <rule name="Rewrite to folder1" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^www.mydomain.com$" />
          </conditions>
          <action type="Rewrite" url="folder1/{R:1}" />
        </rule>
        <rule name="Rewrite to folder2" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^www.myotherdomain.com$" />
          </conditions>
          <action type="Rewrite" url="folder2/{R:1}" />
        </rule>
      </rules>
    </rewrite>
    
        </system.webServer>
    </configuration>
    
     
  4. I am looking to do the same setup, however, I am a bit confused with one item in the answer. When you say root web.config, is this the web.config in one of the subfolders, or a web.config placed into the root of the site? (or something else completely different).

    Thanks,
     
  5. mjp

    mjp

    It is the web.config in the root directory of the site. Settings specified there are inherited in subdirectories, even if they have their own web.config.
     

Share This Page