• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
logo

Tutsplanet

Free Technical and Blogging Resources

  • Home
  • Web Hosting
  • Programming
  • Plugins
  • Write For US
  • News
  • About Us
  • Tools
You are here: Home / Programming / How to Configure Virtual Host in XAMPP on Windows 10

How to Configure Virtual Host in XAMPP on Windows 10

Dec 11, 2019 by Editorial Staff Leave a Comment

Most of the developers start the projects in their local development environment. If you are working with Magento, Drupal, WordPress etc.  you may need virtual hosts to setup, in order to work the test sites properly. When you use virtual hosts each and every links looks very unique, and similar to the main website URL.

So today’s tutorial we are demonstrating how to configure virtual host in XAMPP server in Windows 10.

 

Step #1

Go to the XAMPP installation folder and navigate to C:\xampp\apache\conf\extra. Most of the installatoins will be in the mentioned path, but some of the users opt for a different drive.

Step #2:

Open the file called httpd-vhosts.conf, and there you will find a lot of configuration options, most of them will  be commented out. Do not touch on that lines, just add the below config in the bottom of file.

I just used a configuration lines that I used for Magento 2 development website.

<VirtualHost *:80>
    ServerName m2.staging.com
    DocumentRoot "C:\xampp\htdocs\websites\labs\m2"    
    <Directory "C:\xampp\htdocs\websites\labs\m2">
        DirectoryIndex index.php
        AllowOverride All        
        Allow from all
    </Directory>
</VirtualHost>

Step #3

Next, you need to update the hosts file, navigate to the following folder C:\Windows\System32\drivers\etc, and open hosts file, and add the below line in it.

127.0.0.1 m2.staging.com

Step #4 :

Now, enter the url in the browser and there you go with the new website.

You can add multiple virtual hosts in XAMPP, just add one more entry in the virtual hosts file from the step #2, and point a different ServerName and DocumentRoot. It is as simple as that.

 


Editorial Staff

Editorial Staff at Tutsplanet is a dedicated team to write various tutorials about subjects like Programming, Technology and Operating Systems.

View all posts by Editorial Staff

Filed Under: Programming

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

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

Primary Sidebar




Quick Links

  • A Simple YouTube Video Downloader Script in PHP
  • The 50 Most Useful jQuery Plugins for Frontend Development
  • Word Set 01
  • Convert PNG to JPG Online

Subscribe

* indicates required

Share

   

Hot topics

  • A Simple YouTube Video Downloader Script in PHP 13.3k views
  • Open a URL in a new tab using JavaScript 10.7k views
  • Using Third-Party Libraries in Codeigniter 8.4k views
  • Add FTP/SFTP in Visual Studio Code 6.1k views
  • Replace “\n” with new line characters, using Notepad++ 4.8k views
  • Manually Install APK Files In Android Studio Emulator 4.7k views
  • Upload Multiple Images and Store in Database using PHP and MySQL. 4.5k views
  • How To Install And Use CKEditor In Laravel? 4.2k views
  • Simple PHP Shopping Cart 4k views
  • Spout, an awesome library for reading and writing in Excel. 3.3k views

Categories

  • Design & Development
  • Drupal
  • Facebook
  • General
  • How To
  • ios
  • Javascript
  • Linux
  • Magento
  • Marketing
  • News
  • PHP
  • Plugins
  • Programming
  • Snippets List
  • Social Media
  • Softwares
  • Themes
  • Tips
  • Wordpress
  • YouTube

Copyright © 2021 · TutsPlanet Gene Theme on Genesis Framework · Powered By BunnyCDN