It is actually very easy to create a virtual domain. It only requires two files to be modified and you don’t even have to store your site’s files within the XAMPP directory structure.
UPDATE: do NOT use .dev as the virtual domain. Read this for more information – Chrome AND Firefox Now Redirect .dev Domains to HTTPS.
First you want to go into this directory to make changes to XAMPP in order to set your virtual host/domain.
C:\xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost yourDomain.dev:80> DocumentRoot "C:\websites\your-website\public" ServerName yourDomain.dev <Directory "C:\websites\your-website"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>
Since I am developing in Laravel, I have the public directory defined for the DocumentRoot
The second file you need to change tells Windows to map the local IP address to your virtual domain. Â You just have to add one line to this file, but this file has to be opened as an Administrator in order to save it. Â I use NOTE++ to edit this file.
C:\Windows\System32\drivers\etc\host
In this file simply add this line…
127.0.0.1 Â Â yourDomain.dev
After these two files are updated, start XAMPP, put yourDomain.dev in browser and you should see your local website.