Jump to content


Virtual Hosts and Localhost

  • Please log in to reply
1 reply to this topic

#1 Patrick

  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 25 February 2003 - 12:43 PM

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.



#2 effigy

  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 27 February 2003 - 01:52 AM

you can look into the name based hosting and using \'sitex\' for example:


i\'m not sure how well this will work - the user may have to have the name in their hosts file if there is no dns server present.

Regexp | Unicode Article | Letter Database

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users