Setting a Local Virtual Domain with XAMPP

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.


    DocumentRoot "C:\websites\your-website\public"
    <Directory "C:\websites\your-website">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted

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.


In this file simply add this line…


After these two files are updated, start XAMPP, put in browser and you should see your local website.

Posted in Server, Web Development, XAMPP.
Notify of

Inline Feedbacks
View all comments