Jump to content


This topic is now archived and is closed to further replies.


Virtual Hosts and Localhost

Recommended Posts

Hi there, I have a question, and I\'m not sure if it possible...


I am running Apache, and using localhost for as my test server. It is not serving any pages outside of a localhost environment. The document root is set to htdocs, and each of the sites that I work on sits in a folder in htdocs. I am programming in Dreamweaver MX, and I need to use Site Root relative links.


If I set the document root in Apache\'s config file to htdocs/sitex then http://localhost will give me sitex as expected. But I can\'t access any other site. Without setting the document root to htdocs/sitex, the root relative links in the site all point to the root - htdocs, not where I want them - htdocs/sitex.


I investigated virtual hosts, and it seems that this is only any good for requests being served from outside, and not locally. What I want to achieve is instead of setting the document root to htdocs/sitex and then typing http://localhost to access sitex, I want to be able to type http://sitex (or something) and get sitex and http://sitey for sitey. This will allow site root relative links on all my sites to work as and when required, without changing the apache config settings.


My question then I guess is: is it possible to use virtual hosts locally?


I hope I have explained my situation clearly enough for someone to know what I\'m talking about and even possibly come back with an answer to my problem. Any assistance is greatly appreciated.





Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.