Home Technology how to create virtual host in xampp?

how to create virtual host in xampp?

by therichpost
0 comments

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

You may also like

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.