Create a folder in htdocs folder named test.local and create index.php file in it.

To create a virtual host in Apache just follow simple steps :-

  1. Go to C:\xampp\apache\conf\extra\httpd-vhosts
  2. Paste the below code

Here test.local is your virtual host, you can change as per your choice.

NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin webmaster@test.local
    DocumentRoot "C:/xampp/htdocs/test.local/"
    ServerName test.local
    ErrorLog "logs/test.local-error.log"
    CustomLog "logs/test.local-access.log" common
    <Directory "C:/xampp/htdocs/test.local/">
        Options Indexes FollowSymLinks Includes ExecCGI
        Require all granted

3. Go to C:\Windows\System32\drivers\etc\hosts

4. You can see the below code already

# localhost name resolution is handled within DNS itself.
#       localhost

Below this code just paste your code where you have to mention your virtual host:-       test.local

5. Restart Xampp

6. Type in your browser:-

test.localThese designations allow the administrator to use one server to host multiple domains or sites off of a single interface or IP by using a matching mechanism. 

Category: Xampp
Balbir KaurPHP and WordPress