Setting up a virtual host in XAMPP

< 1 min read
Reading Time: < 1 minute

Setting up a virtual host in XAMPP is a 4 step process:

1. Create a directory under C:\xampp\htdocs where the site will reside:

C:\xampp\htdocs\newsite

2. Edit your hosts file (c:\windows\system32\drivers\etc\hosts) to get the new site to point to you localhost:

127.0.0.1 newsite.dev

3. Now change the virtual hosts file in xampp (C:\XAMPP\apache\conf\extra\httpd-vhosts.conf):

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/newsite"
ServerName newsite.dev
</VirtualHost>

4. Restart Apache