URL Redirection on a Single IIS Server

URL Redirection on a Single IIS Server

am 06.11.2007 15:00:01 von cswarr

I have two URL's that I want to host on a single server. However, I want
them to go to separate directories within IIS when they are entered into the
browser. For example, say my server name is websvr1 and the directories on
the server are wdir and wdir1. If the URL's that resolve to websvr1 are
site.domain.com and site1.domain.com, then this should happen:

User enters SITE.DOMAIN.COM and should land in the wwwroot\wdir directory on
websvr1
User enters SITE1.DOMAIN.COM and should land in the wwwroot\wdir1 directory
on websvr1

I can set a default page for IIS, but then every request gets directed to
that site, regardless of the URL that was entered. How can I accomplish my
goal of having two different URL's that resolve to the same IIS server point
to different directories? I'm running Win2k3, SP2. Thanks.

Re: URL Redirection on a Single IIS Server

am 06.11.2007 15:28:13 von Anthony Jones

"cswarr" wrote in message
news:B888FFE2-671C-48B6-9423-994F6BC0EACD@microsoft.com...
> I have two URL's that I want to host on a single server. However, I want
> them to go to separate directories within IIS when they are entered into
the
> browser. For example, say my server name is websvr1 and the directories
on
> the server are wdir and wdir1. If the URL's that resolve to websvr1 are
> site.domain.com and site1.domain.com, then this should happen:
>
> User enters SITE.DOMAIN.COM and should land in the wwwroot\wdir directory
on
> websvr1
> User enters SITE1.DOMAIN.COM and should land in the wwwroot\wdir1
directory
> on websvr1
>
> I can set a default page for IIS, but then every request gets directed to
> that site, regardless of the URL that was entered. How can I accomplish
my
> goal of having two different URL's that resolve to the same IIS server
point
> to different directories? I'm running Win2k3, SP2. Thanks.

Create two websites on websvr1 calles Site and Site1. When create a website
the wizard asks you to enter a host header for the site, for Site leave this
box blank) but for Site1 enter site1.domain.com.

When asked for the home directory enter the full path to wdir for Site and
wdir1 for Site1.

Disable the default website.

Now when someone visits Site1.domain.com they get wdir1 for anything else
including websvr1 they will end up in wdir.

If you still want the default website then you should move wdir(s) out of
the wwwroot or block access to them via the default website. You should
also give a Site a site.domain.com host header.




--
Anthony Jones - MVP ASP/ASP.NET

Re: URL Redirection on a Single IIS Server

am 06.11.2007 15:50:04 von cswarr

Thanks for they reply Anthony. I already do have two sites created on my web
server, wdir and wdir1. That being the case, can I go into wdir and take out
the host header? How do I do that? As you can see, I'm not an IIS guru!
Thanks, again.

"Anthony Jones" wrote:

> "cswarr" wrote in message
> news:B888FFE2-671C-48B6-9423-994F6BC0EACD@microsoft.com...
> > I have two URL's that I want to host on a single server. However, I want
> > them to go to separate directories within IIS when they are entered into
> the
> > browser. For example, say my server name is websvr1 and the directories
> on
> > the server are wdir and wdir1. If the URL's that resolve to websvr1 are
> > site.domain.com and site1.domain.com, then this should happen:
> >
> > User enters SITE.DOMAIN.COM and should land in the wwwroot\wdir directory
> on
> > websvr1
> > User enters SITE1.DOMAIN.COM and should land in the wwwroot\wdir1
> directory
> > on websvr1
> >
> > I can set a default page for IIS, but then every request gets directed to
> > that site, regardless of the URL that was entered. How can I accomplish
> my
> > goal of having two different URL's that resolve to the same IIS server
> point
> > to different directories? I'm running Win2k3, SP2. Thanks.
>
> Create two websites on websvr1 calles Site and Site1. When create a website
> the wizard asks you to enter a host header for the site, for Site leave this
> box blank) but for Site1 enter site1.domain.com.
>
> When asked for the home directory enter the full path to wdir for Site and
> wdir1 for Site1.
>
> Disable the default website.
>
> Now when someone visits Site1.domain.com they get wdir1 for anything else
> including websvr1 they will end up in wdir.
>
> If you still want the default website then you should move wdir(s) out of
> the wwwroot or block access to them via the default website. You should
> also give a Site a site.domain.com host header.
>
>
>
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>
>

Re: URL Redirection on a Single IIS Server

am 06.11.2007 16:43:40 von Anthony Jones

"cswarr" wrote in message
news:DBDEBFBD-9E0D-4F0C-BE6B-1D52F6E63EAE@microsoft.com...
> Thanks for they reply Anthony. I already do have two sites created on my
web
> server, wdir and wdir1. That being the case, can I go into wdir and take
out
> the host header? How do I do that? As you can see, I'm not an IIS guru!
> Thanks, again.
>


To add a host header to a site right mouse click the site and choose
properties.
On the Web Site tab in the Web Site Indentification frame click Advanced...

In the Advanced Multiple Web Site Configuration dialog there ias a Multiple
identities for this Web Site frame click Add...

Leave IP Address set to All Unassigned, set port to 80 and enter
site1.domain.com (or site.domain.com) in the host header name. Click OK.
Highlight the item in the list with a blank host header name and click
remove.
For completeness I usually add another entry for the host name alone (Eg. in
this case Site OR Site1 (no domain)).

If you want one of these sites to act as the default then make sure it has
an entry with a blank host header name.



--
Anthony Jones - MVP ASP/ASP.NET

Re: URL Redirection on a Single IIS Server

am 13.11.2007 15:43:00 von cswarr

Thanks for all your help Anthony. I have one more question - can you use
host headers and accomplish the same thing if the sites are virtual
directories under the Default Web Site in IIS? That's my current situation.
I've tried to create separate web sites in IIS for the two sites, but the
utility that I'm using to create the sites doesn't seem to like that. The
utility allows you to create multiple sites, but it creates virtual
directories under the Default Web Site.

"Anthony Jones" wrote:

>
> "cswarr" wrote in message
> news:DBDEBFBD-9E0D-4F0C-BE6B-1D52F6E63EAE@microsoft.com...
> > Thanks for they reply Anthony. I already do have two sites created on my
> web
> > server, wdir and wdir1. That being the case, can I go into wdir and take
> out
> > the host header? How do I do that? As you can see, I'm not an IIS guru!
> > Thanks, again.
> >
>
>
> To add a host header to a site right mouse click the site and choose
> properties.
> On the Web Site tab in the Web Site Indentification frame click Advanced...
>
> In the Advanced Multiple Web Site Configuration dialog there ias a Multiple
> identities for this Web Site frame click Add...
>
> Leave IP Address set to All Unassigned, set port to 80 and enter
> site1.domain.com (or site.domain.com) in the host header name. Click OK.
> Highlight the item in the list with a blank host header name and click
> remove.
> For completeness I usually add another entry for the host name alone (Eg. in
> this case Site OR Site1 (no domain)).
>
> If you want one of these sites to act as the default then make sure it has
> an entry with a blank host header name.
>
>
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>
>

Re: URL Redirection on a Single IIS Server

am 15.11.2007 10:25:46 von Anthony Jones

"cswarr" wrote in message
news:53C1AB6D-D1A7-48B8-BA30-315C35C2C661@microsoft.com...
> Thanks for all your help Anthony. I have one more question - can you use
> host headers and accomplish the same thing if the sites are virtual
> directories under the Default Web Site in IIS? That's my current
situation.
> I've tried to create separate web sites in IIS for the two sites, but the
> utility that I'm using to create the sites doesn't seem to like that. The
> utility allows you to create multiple sites, but it creates virtual
> directories under the Default Web Site.
>

In that case the utility is not creating multiple sites. I suspect Its
creating multiple Web applications as virtual folders of the default site.

It is possible to create a Website on a physical folder which also appears
as a virtual folder in another site.


--
Anthony Jones - MVP ASP/ASP.NET