views:

1140

answers:

4

Is there a way to setup subdomains udner Xp Pro IIS for something like test.localhost

Can it be done via IIS or the hosts file? Need to do a tets on a site that uses pathign back to the root so having the site ina virtual directory like localhost/test causes issues.

A: 

Create a new website in IIS. The host header value should be your subdomain like "sub.localhost", and then add the domain to your hosts file.

Andrew Noyes
Won't work on XP pro--IIS is hamstrung to only one site.
Wyatt Barnett
Ah my bad. I was thinking that was only a limitation on Home.
Andrew Noyes
XP home doesn't even have IIS . . .
Wyatt Barnett
You can add it.
Andrew Noyes
+2  A: 

As you're probably well aware that out of the box IIS 5.1 only supports one web site. What you can do is use the adsutil.vbs tool to create a second site in IIS 5.1 and configure it to use that.

The following article explains the process:

IIS: Creating Multiple Web Sites within IIS on Windows 2000 and Windows XP Professional

There's even a GUI widget to make life easy:

http://www.firstserved.net/support/downloads

So in a nutshell:

  1. Create a second site using one of the methods above (set the IP address to your machine's primary IP address)
  2. Add a host header for test.localhost domain to the new site
  3. Edit the HOSTS and add an entry for test.localhost pointing at the IP address above
Kev
That GUI utlity worked great, thanks.
schooner
No probs, glad it worked for you :)
Kev
A: 

open with notepad the file c:\windows\system32\drivers\etc

and add this line:

 127.0.0.1 mysuper-site.com.net.blabla

Then browse to this site: http://mysuper-site.com.net.blabla

elcuco
That won't help if the web server isn't set up to recieve the subdomain request.
Andrew Noyes
Yes how would I map that to the subdomain?
schooner
wait... isn't IIS listning on 127.0.0.1? When I do this setup in apache, the application is responsible for determinating the domain (well, apache can do this on itself as well...)
elcuco
A: 

Easiest way is to just switch the document root of the lone site you already have to the different folder with the target site. Then you can switch it back when done.

If you are building stuff in virtual directories off the root, this shouldn't even effect any ongoing projects.

I seem to recall there was a tool which did this for you, but I've forgotten it's name and coordinates.

Wyatt Barnett