6

I currently have an IIS6 server that hosts one web site/domain. I am developing another web site (completely separate) that I want to host on this same server. Both domains were purchased from GoDaddy.

I believe I will need a server-side ISAPI rewrite filter to internally route the incoming requests based on the domain name. I plan to use Ionic's ISAPI Rewrite Filter to do this because it is free. I know how to install the ISAPI filter and apply it to a web site in IIS, but I have no clue how I am going to route the incoming requests correctly (based on the domain).

Also, I don't know if it is wise to setup multiple "Web Sites" or "Virtual Directories". I am thinking that this will depend on how the configured.

How should I go about getting this accomplished?

5 Answers 5

7

You don't want rewrite rules at all, you do want to setup a new website configuration. IIS 6 can differentiate between websites via either using a new IP address (so the server has multiple IP addresses), or by using a host header to link a domain to a website configuration.

Try starting here: Hosting Multiple Web Sites on a Single Server (IIS 6.0) and Using Host Headers to host multiple websites on IIS 6.0

7
  • Thank you! I can't believe I have never seen this host header before. Is there an easy way I can see the host header that is currently coming in for the existing domain? I just want to see it. Jul 28, 2009 at 19:20
  • I was able to view it here: web-sniffer.net So can you think of any caveats with using the HOST header approach? Thanks again! Jul 28, 2009 at 19:27
  • Host headers are pretty much the standard way to host multiple websites on one server. The only real caveat I can think of is if you want a https website - those generally require one IP address per website. If you are just after a standard website, you should have no issues with host headers.
    – Moo
    Jul 28, 2009 at 19:32
  • Problems. The host can be www.whatever.com or whatever.com, right? So how do I resolve this issue? Jul 28, 2009 at 23:13
  • What issue? Add both hostnames to the host header list and the same website will be used for both of them. Or you can setup a second website for whatever.com and use an IIS redirect to redirect your users to www.whatever.com. Both solutions work - the first is easiest, the second is cleaner as you end up with one single hostname being used in your web apps.
    – Moo
    Jul 29, 2009 at 8:05
3

I see no problem here. IIS 6 can host hundreds of websites - even for on the same IP address (except for https you'll need a dedicated IP address) - distinguishing them by the host header (domain name).

Read this Microsoft Support article: HOW TO: Use Host Header Names to Configure Multiple Web Sites in Internet Information Services 6.0:

Microsoft Internet Information Services (IIS) permits you to map multiple Web sites with the same port number to a single IP address by using a feature called Host Header Names. By assigning a unique host header name to each Web site, this feature permits you to map more than one Web site to an IP address.

I think Ionic's ISAPIRewrite filter is applied to web sites, each web having its own definition file. I use a similar filter (ISAPI Rewrite) on my IIS servers, with many web sites on the server without any problem.

2

All you're looking for is Host Headers. As long as the host headers are different, multiple sites can share the same port. Go to the properties of the site, and under the "Advanced" button next to the IP Address binding dropdown, you can edit the port and host header(s) for the site.

No more drama than that. ;)

1

Splattne and others are correct - IIS6 alone can host multiple web sites.

A rewriter like IIRF is useful for rewriting requests as they come in. For example, you could rewrite a request on the server side, which arrives for host1.domain.com, to be served by the vdir "normally" associated to host2.

URL Rewriting is not necessary in order to host multiple websites.

0

Adding to everyone's answer, I was having some issue configuring IIS to just do it for simple local testing environment. Thing is: it doesn't do on itself, as we would like.

So gathering what others said here, I think the best way to have Multiple IIS Sites is using Host Header Names and that is quite easy to set up (thanks Moo for the links). On IIS 6, if you have a site already created, that's just going to "Bindings". Easy to find references on google for that.

older IIS

alt text

IIS 6

alt text

Then I needed to set up the hosts file. That is simple enough for 1 site, but it's kind of a harsh for multiple sites, and that's why we'd expect to be able to do it on IIS. No such luck. Just do it yourself.

HOSTS

alt text

Of course, that's all what everyone said already, except it's certainly better to do it on a DNS and all... But this is enough for local testing, and I think it should be built in IIS an option to do it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .