Search code examples
windowsxampphost

How to create virtual host in Xampp windows 10


I want to setup virtual host for my local project.

I added this code into C:\xampp\apache\conf\extra\httpd-vhosts.conffile.

<VirtualHost *:80>
    DocumentRoot "c:/xampp/htdocs/bab/"
    ServerName bab.local
    <Directory "c:/xampp/htdocs/bab/">
    </Directory>
</VirtualHost>

I added this code into C:\Windows\System32\drivers\etc\hostsfile.

127.0.0.1       bab.local

please help.....


Solution

  • You need to correct your settings like below :- need to define {projectName}

    <VirtualHost *:80>
        DocumentRoot "c:/xampp/htdocs/bab/{projectName}"
        ServerName bab.local
        <Directory "c:/xampp/htdocs/bab/">
    
        </Directory>
    </VirtualHost>