Open file /Applications/XAMPP/xamppfiles/etc/httpd.conf and uncomment
#Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
sudo nano /Applications/XAMPP/etc/extra/httpd-vhosts.conf
sudo nano /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
A sample virtual directory will be like below:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
We also change the host file:
sudo nano /etc/hosts
XAMPP VirtualHost mappings
127.0.0.1 mysite.local