Step 1:

Open file host in the path “C:\Windows\System32\drivers\etc\” and add following at the bottom,

  • 127.0.0.1 mysite.local
  • 127.0.0.1 localhost

make sure 127.0.0.1 localhost at the bottom.

Step 2:

Open file httpd.conf in the path “C:\wamp\bin\apache\Apache2.4.4\conf\” and do the following,

  • Change Listen :80 to Listen *:80
  • Change #Include conf/extra/httpd-vhosts.conf to Include conf/extra/httpd-vhosts.conf

Step 3:

Open file httpd-vhosts.conf in the path “C:\wamp\bin\apache\Apache2.4.4\conf\extra\” and add following at the bottom,

  • NameVirtualHost *:80<Directory “F:/My Projects”>
    Order Deny,Allow 
    Allow from all 
    </Directory><VirtualHost *:80> 
    DocumentRoot “C:/wamp/www/” 
    ServerName localhost
    </VirtualHost>

    <VirtualHost *:80> 
    DocumentRoot “F:/My Projects/mysite” 
    ServerName mysite.local
    </VirtualHost>

Create a folder My Projects and sub folder mysite in F: drive as shown above DocumentRoot. Create a index.php file in mysite folder and copy and paste following code in it.

<?php echo “Hello World”; ?>

then restart your wamp server and check http://mysite.local in browser then it must show Hello World on the page.