How To Setup Virtual Hosts Using XAMPP

xamppp

Usually Developers using their local environment while doing development, but once work done then they use staging url to test the code. But some time all the third party apis will not work on your local environment then you require to setup the virtual hosts. That will allowed you run your local server on a proper url like staging environment. Using below steps you can easily setup VHosts or Virtual Hosts on wamp server.

  1. Open this file httpd-vhosts.conf present in C:/xampp/apache/config/extra/
  2. add this code, sample :- NameVirtualHost *:80
    <VirtualHost *:80>
    DocumentRoot “d:/websites/sassnew/”
    ServerName sassnew
    </VirtualHost>
  3. Open file hosts present in “C:/Windows/System32/drivers/etc” using auth as admin and add this line
  4. 127.0.0.1 localhost
    127.0.0.1 sassnew
  5. Now restart apache and you can use now sassnew/

I guess this will help you.