Hey all...i have a quick question; hopefully there's an easy answer.

right now on my system (IIS 6.0) I have my default website (web root)
with multiple sites under it. I access them as
http://localhost/sitename

I need to access a site within there as it's own website. If I make
that site it's own website, and modify the hosts file to:

127.0.0.1 localhost dev.sitename.com

it works. however, i lose access to my webroot. i'm wondering if i
can keep my default website running, but have something like:

127.0.0.1 localhost
127.0.0.1/sitedir dev.sitename.com

thanks.

Re: Hosts File and Subdirectories Question by Kristofer

Kristofer
Wed May 03 15:18:36 CDT 2006

Hello,

An IP address is an IP address, and a folder is a folder.
127.0.0.1/sitedir is an IP address and a folder, it is not an IP address,
hence you cannot treat it as an IP address in the hosts file. A hostname
cannot be mapped to an IP address and folder (by the specification), it
can only be mapped to an IP address, hence what you are asking for is
impossible to do.

Why not have multiple websites? That would be better, and you could use
host headers. Your description of your setup indicates that you do not
have multiple websites. You have one website, with multiple (virtual?)
folders. A virtual folder is not a website.

By creating multiple websites, and use host headers to distinguish them,
you could modify your hosts file like this:

127.0.0.1 dev.sitename.com
127.0.0.1 www.sitename.com
127.0.0.1 whatever.sitename.com

In this situation, IIS will use the host header, sent as part of the HTTP
header, to know which website is designated.


--
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info


rh1200la@gmail.com wrote:

>Hey all...i have a quick question; hopefully there's an easy answer.
>
>right now on my system (IIS 6.0) I have my default website (web root)
>with multiple sites under it. I access them as
>http://localhost/sitename
>
>I need to access a site within there as it's own website. If I make
>that site it's own website, and modify the hosts file to:
>
>127.0.0.1 localhost dev.sitename.com
>
>it works. however, i lose access to my webroot. i'm wondering if i
>can keep my default website running, but have something like:
>
>127.0.0.1 localhost
>127.0.0.1/sitedir dev.sitename.com
>
>thanks.

Re: Hosts File and Subdirectories Question by rh1200la

rh1200la
Wed May 03 17:02:31 CDT 2006

i also have the directory setup as a seperate website as well.

however, when i have both sites running, if i go to:

dev.mysite.com it hits my default website.

i read somewhere in order to do this you cannot have your Default
Website running, but rather any other one. is that true?

thanks.


Re: Hosts File and Subdirectories Question by Kristofer

Kristofer
Thu May 04 00:10:48 CDT 2006

No, that is not true.

We need more information about how you have setup multiple websites to be
able to tell why this is happening. But one scenario where this will
happen is if you do not have any website with the host header name
"dev.mysite.com", and when this host header is sent to IIS, it sends the
request to the website that is configured with a wild card for the host
header (which "default website" is by default).

Another scenario is that your HTTP client does not support HTTP 1.1 (rare).

--
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info


rh1200la@gmail.com wrote:

>i also have the directory setup as a seperate website as well.
>
>however, when i have both sites running, if i go to:
>
>dev.mysite.com it hits my default website.
>
>i read somewhere in order to do this you cannot have your Default
>Website running, but rather any other one. is that true?
>
>thanks.

Re: Hosts File and Subdirectories Question by Kristofer

Kristofer
Thu May 04 00:12:29 CDT 2006

By the way, i have an article on using host headers to run multiple
websites, it may be useful:

"Article: Using Host Headers to host multiple websites on IIS 6.0"
http://www.gafvert.info/notes/iis_multiple_websites.htm


--
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info


rh1200la@gmail.com wrote:

>i also have the directory setup as a seperate website as well.
>
>however, when i have both sites running, if i go to:
>
>dev.mysite.com it hits my default website.
>
>i read somewhere in order to do this you cannot have your Default
>Website running, but rather any other one. is that true?
>
>thanks.