Localhost subdomain on XP Pro IIS?
-
05-07-2019 - |
Question
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.
Solution
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:
So in a nutshell:
- Create a second site using one of the methods above (set the IP address to your machine's primary IP address)
- Add a host header for
test.localhost
domain to the new site - Edit the HOSTS and add an entry for
test.localhost
pointing at the IP address above
OTHER TIPS
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.
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.
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