Create virtual hosts in XAMPP on Windows

1. Edit Hosts File

This maps your custom domains to your local machine.

📍 File location:

C:\Windows\System32\drivers\etc\hosts

👉 Open Notepad as Administrator, then add:

127.0.0.1   oft.local
127.0.0.1 dash.oft.local

Save the file.


2. Enable Virtual Hosts in Apache

Open:

C:\xampp\apache\conf\httpd.conf

Find this line and uncomment it (remove #):

#Include conf/extra/httpd-vhosts.conf

Change to:

Include conf/extra/httpd-vhosts.conf

3. Configure Virtual Hosts

Open:

C:\xampp\apache\conf\extra\httpd-vhosts.conf

Add the following configuration:

<VirtualHost *:80>
ServerName oft.local
DocumentRoot "C:/xampp/htdocs/oft"
<Directory "C:/xampp/htdocs/oft">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost><VirtualHost *:80>
ServerName dash.oft.local
DocumentRoot "C:/xampp/htdocs/dash"
<Directory "C:/xampp/htdocs/dash">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

4. Create Project Folders

Make sure these folders exist:

C:\xampp\htdocs\oft
C:\xampp\htdocs\dash

Add an index.php or index.html file in each for testing.


5. Restart Apache

Open XAMPP Control Panel → Stop Apache → Start Apache again.

Promo Bot

Leave a Reply

Your email address will not be published. Required fields are marked *

EnglishenEnglishEnglish