Open up httpd-vhosts.conf under /xampp/apache/conf/extra
Change:
- Code: Select all
#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80
#
# VirtualHost example:
#
To:
- Code: Select all
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
#
Then scroll down a bit you will see:
- Code: Select all
##<VirtualHost *:80>
##ServerAdmin postmaster@dummy-host.localhost
##DocumentRoot "C:/xampppy/xampp/htdocs/dummy-host.localhost"
##ServerName dummy-host.localhost
##ServerAlias www.dummy-host.localhost
##ErrorLog "logs/dummy-host.localhost-error.log"
##CustomLog "logs/dummy-host.localhost-access.log" combined
##</VirtualHost>
##<VirtualHost *:80>
##ServerAdmin postmaster@dummy-host2.localhost
##DocumentRoot "C:/xampppy/xampp/htdocs/dummy-host2.localhost"
##ServerName dummy-host2.localhost
##ServerAlias www.dummy-host2.localhost
##ErrorLog "logs/dummy-host2.localhost-error.log"
##CustomLog "logs/dummy-host2.localhost-access.log" combined
##</VirtualHost>
Here is an example of mine i use on my server (you can add this at the end of the file):
- Code: Select all
<VirtualHost *:80>
DocumentRoot C:\xampp\htdocs\craigsbe
ServerName CraigS.be
ServerAlias www.CraigS.be
</VirtualHost>
In the above you can see ServerName and Server Alias, what these do is tell apache to 'listen' for requests for Craigs.be and
http://www.Craigs.beEdit: To have this work, you MUST have the domain name actually point to the server, the apache server gets the domain info from the browser; Also if you check the documentation, the first entry in this table will be the default site that will load up if you do not specify a name (such as entering in the servers ip address) (For example i have craigs1.be and craigs2.be listed under the same ip address, when i go to the ip address of the server it will load craigs1.be 's site, since again it is listed first.
Hope this helps
Craig S