Jump to content

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.

 

Regards,

 

Patrick

Link to comment
https://forums.phpfreaks.com/topic/181-virtual-hosts-and-localhost/
Share on other sites

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

 

http://httpd.apache.org/docs-2.0/vhosts/na...name-based.html

 

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.

 

:shock:

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.