How to enable Virtual Host on Xampp for Laravel? How to enable Virtual Host on Xampp for Laravel? laravel laravel

How to enable Virtual Host on Xampp for Laravel?


The hosts file should look like this so that it can be found on the IPV4 and IPV6 networks

127.0.0.1  localhost dev.app::1        localhost dev.app

If you are using Apache 2.4.x this line in httpd-vhosts.conf

NameVirtualHost *:80

is no longer required or allowed for Apache 2.4.

The vhost file should look like this, you mixed Apache 2.2 and 2.4 syntax and while either is allowed as long as you have mod_access_compat activated, you should not mix them and the 2.4 syntax is better. You also missed a few other useful bits and pieces

<VirtualHost *:80>    DocumentRoot "F:/xampp/htdocs/"    ServerAdmin admin@localhost    ServerName localhost    <Directory "F:/xampp/htdocs/">       Options Indexes FollowSymLinks       AllowOverride all       Require local    </Directory></VirtualHost><VirtualHost *:80>    DocumentRoot "F:/xampp/htdocs/dev/public"    ServerAdmin admin@localhost    ServerName dev.app    ServerAlias www.dev.app    <Directory "F:/xampp/htdocs/dev/public">       AllowOverride All       Options Indexes FollowSymLinks       Require local       # if you want access from other pc's on your local network       #Require ip 192.168.1       # Only if you want the world to see your site       #Require all granted    </Directory></VirtualHost>


Use laragon server instead of XAMPP. One of useful features of Laragon is Auto Virutal Hosts.learn more about Pretty URLs with laragon here


`open C:\xampp\apache\conf\httpd.conf, locate at

Virtual hosts

#Include conf/extra/httpd-vhosts.conf, remove # in this line,save file,Restart server`