views:

19

answers:

2

Hi,

I have a web server running xampp. I have two domain names lets call them www.domain1.com and www.domain2.com. I have updated the dns settings of domain1 to point to my server which is working fine, (i.e the files for domain1 are in the htdocs folder and when i go to www.domain1.com in a browser i get the index file of these files.) What I would like to do though is have two folders in the htdocs folder (one for domain1 and one for domain2). If i change the dns settings of domain1 and domain2 to both point to my servers ip, can i then configure xampp or apache to load the right site depending on what url has been requested?

Thanks

+2  A: 

Yes. Its called Name-based virtual host support. Xampp runs Apache under the covers which supports this. See this article here. Basically you have to edit your apache configuration files such that you bind a domain name to a folder where the data resides. Not sure exactly how to do this on Windows, but seems like laurencek have you covered there.

See also this article on Virtual Hosting from Wikipedia

Hannes de Jager
+2  A: 

Yes this is easy to do. You simply need to create 1 or 2 virtual hosts in apache. This is done by editing the /apache/conf/extra/httpd-vhosts.conf file in your xampp installation. The file should have the details in it that you need. Apache will need to be restarted for the changes to happen.

laurencek