2

I'm trying to add a new web site on an existing IIS v7 which has its default web site installed. My problem is that I have conflict since I can't give:

Different host name Different local IP Different port I was asked to try and do the following. Lets say the default web site can be accessed through www.something.com, than I should try to configure the new web site with www.something.com/new_web_site

Is it possible from the web site configuration?

Is it possible to put some kind of redirect page in a sub folder name new_web_site under the default web site physical location that will redirect the real physical location of the new web site files?

Lior Ohana
  • 135
  • 1
  • 4

2 Answers2

4

A combination of ARR and rewrite rules will solve this nicely. Here's the steps to follow:

  1. Download and install ARR http://www.iis.net/download/ApplicationRequestRouting
  2. In IIS Manager, select your machine in the Connections pane, double-click the Application Request Routing feature in the IIS section, click on the "Server Proxy" link in the Actions pane, then check the "Enable proxy" checkbox and choos the Apply action.
  3. Change the bindings of your two existing websites--For instance, bind the Released website to port 81, and the Experimental website to port 82.
  4. Create a new website and apppool, and bind it "http:*:80:". Name it "Default Web Site". Point it's physical path to "%SystemDrive%\inetpub\DefaultWebSite"
  5. Create a web.config file for the "Default" website, and write your routing rules there:

    <rules>
        <rule name="Reverse Proxy for Experimental" stopProcessing="true">
            <match url="^.*/experimental/.*" />
            <action type="Rewrite" url="http://{HTTP_HOST}:82/{R:0}" />
        </rule>
        <rule name="Reverse Proxy for Release" stopProcessing="true">
            <match url=".*" />
            <action type="Rewrite" url="http://{HTTP_HOST}:81/{R:0}" />
        </rule>
    </rules>
    
  6. You may have to fiddle somewhat with your rewrite rules, you can experiment using the URL Rewrite Module applet on IIS, and read more about it here: http://learn.iis.net/page.aspx/500/testing-rewrite-rule-patterns/ For further help be sure and browse Ruslan Yakushev's blog: http://ruslany.net/

This will give you three completely separate websites, accessibly through a single facade on port 80 (though of course you can hit each website directly on port 81 and 82 if you need to: http://localhost:81/default.aspx for example.

0

How about adding host headers for the additional web sites in the bindings of the default web site?

joeqwerty
  • 109,901
  • 6
  • 81
  • 172
  • How will the host headers will help me when I have only one DNS name attached to the server? If my web site is www.something.com in which way will I be able to access multiple sites? – Lior Ohana Aug 25 '11 at 17:14
  • I probably misunderstood your question slightly, but the best solution would be to register and use a unique domain name for each web site. – joeqwerty Aug 25 '11 at 17:25
  • I'm sorry for the dumb questions, I'm pretty new to the world of web and IIS. What do you mean by domain name. How will my urls will look like for website1 and website2. 10x – Lior Ohana Aug 25 '11 at 17:29
  • www.domain1.com, www.domain2.com, www.thisdomain.com, www.thatdomain.com, etc., etc. – joeqwerty Aug 25 '11 at 17:31
  • When you register the domain names you would add A or CNAME DNS records to the name servers for those domains that point to your web server ip address and add those domains as host headers on the default web site. The host headers would be: www.thisdomain.com, www.thatdomain.com, etc., etc.). – joeqwerty Aug 25 '11 at 17:33
  • Please correct me if I'm wrong, that will require me to buy several domains, each for one site, right? My problem is not the money (I wish), the real problem is that I would like to reduce the amount of admin work of my client. I'm limited to a single domain name. – Lior Ohana Aug 25 '11 at 17:53