Technologyxampp

how to create virtual host in xampp?

create virtual host in xampp

584Views

Hello to all, welcome to therichpost.com. In this post, I will tell you, how to create virtual host in xampp? Xampp is free and open source cross-platform web server solution. Xampp containing PHP, MYSQL etc.

Benefits of creating virtual host is you can easily make make urls clean and many more.

1. First you need to add the following code in C:/xampp/apache/config/extra/httpd-vhosts.config file:

<VirtualHost 127.0.0.2:80>
    DocumentRoot "C:/xampp/htdocs/therichpost"
  ServerName therichpost.localhost
</Directory>
</VirtualHost>

2. After it your need to add the below code in C:\Windows\System32\drivers\etc\hosts file:

127.0.0.2       therichpost.localhost #change to match your Virtual Host.

3. After this restrat your xampp server and you can open your website with "therichpost.localhost" link.


Now you can open your localhost like:
First before applying virtual host:
localhost/therichpost


After applying virtual host:
therichpost.localhost

 There are so many code tricks in Xampp and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

Ajay Malhotra
the authorAjay Malhotra
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am full stack developer. I love coding. I know Wordpress, Core php, Angularjs, Angular 2, Angular 6, laravel, Codeigniter, Shopify, Squarespace, Jquery, Google Map Api, Vuejs, Reactjs, Bigcommerce etc.

Leave a Reply