Open your terminal and run this command to setup hosts local ip mapping. Install vim if not exist
> sudo vim /etc/hosts
//Add this line and save
127.0.0.1 mytestdomain.com
Now go to your lampp etc folder
> cd /opt/lampp/etc/
Open httpd.conf file from etc folder to edit
> sudo vim httpd.conf
un-comment below line from httpd.conf file
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Now go inside extra folder and open httpd-vhosts.conf file to edit
> cd /opt/lampp/etc/extra/
> sudo vim httpd-vhosts.conf
Add below lines of code at the very bottom the of file
<VirtualHost *:80>
DocumentRoot "/opt/lampp/htdocs/project/webroot"
ServerName mytestdomain.com
DirectoryIndex index.php
<Directory "/opt/lampp/htdocs/project/webroot">
Require all granted
</Directory>
</VirtualHost>
Finally restart lampp server with below command
> sudo /opt/lampp/lampp restart
Thats all.
Now you can browse your local project through this url: http://mytestdomain.com