How to Setup VHOSTS on Xamp

by Hiroshi on October 20, 2008

in Softwares

Following are the steps you need to take to create a new vhost in the XAMP.
Step 1 & 2 is once only and is needed if you have a fresh installation of XAMP.

1- Enable/Uncomment The following line in your /xamp/apache/conf/httpd.ini file
LoadModule vhost_alias_module modules/mod_vhost_alias.so

2- Open your /xampe/apache/conf/extra/httpd-vhosts file and uncomment following line
NameVirtualHost *:80

3- Now if you have to map a vhost for any of your new project. Add the following block of lines in the same httpd-vhosts file at the end. Remember to change these blocks to meet your DOMAIN name and DIRECTORY structure.

<VirtualHost *:80>
    DocumentRoot C:/User/Projects/website/code
    ServerName websitename.domainname.com
<Directory "C:/User/Projects/website/code">
Allow from all
</Directory>
</VirtualHost>

The above block will map websitename.domainname.com to specified directory

4- Restart Apache and you are ready to go.

Related Posts

Previous post:

Next post: