Skip to main content
Key2Goal

Main navigation

  • Home
  • About Us
  • Contact us
  • Glossary
  • Privacy Policy
User account menu
  • Log in

Breadcrumb

  1. Home

Create a Virtual Host on Xampp in 5 steps

To create a virtual host (vhost) using XAMPP, you'll need to follow these steps:

Step 1: Open the Apache configuration file

  1. Locate the httpd-vhosts.conf file in the XAMPP installation directory. By default, it's located at C:\xampp\apache\conf\extra\httpd-vhosts.conf.
  2. Open the file in a text editor.

Step 2: Configure the virtual host

  1. Add the following code at the end of the file to define your virtual host:

    <VirtualHost *:80>
        DocumentRoot "C:/xampp/htdocs/your_project_folder"
        ServerName yourdomain.test
    </VirtualHost>

     

    Replace "C:/xampp/htdocs/your_project_folder" with the actual path to your project folder. This is the directory where your website's files reside. Replace "yourdomain.test" with the desired domain name for your virtual host. You can choose any domain name, but make sure to add it to the hosts file as well (explained in the next step).

Step 3: Modify the hosts file

  1. Open the hosts file on your computer. It's located at C:\Windows\System32\drivers\etc\hosts.
  2. Open the file in a text editor with administrative privileges.
  3. Add the following line at the end of the file:

    127.0.0.1    yourdomain.test

    Replace "yourdomain.test" with the same domain name you used in the virtual host configuration.

Step 4: Restart Apache server

  1. Open the XAMPP Control Panel.
  2. Stop the Apache server by clicking the "Stop" button.
  3. Start the Apache server again by clicking the "Start" button.
  4. Open your web browser.
  5. Visit http://yourdomain.test (replace "yourdomain.test" with your chosen domain name).
  6. If everything is set up correctly, you should see your website served from the specified project folder.
  7. That's it! You have successfully created a virtual host using XAMPP. Now you can develop and access your website using the custom domain name you configured.

Step 5: Access your virtual host

  • Log in to post comments

Comments

Article category

  • Drupal
  • Wordpress
  • Java
  • Javascipt
  • HTML
  • CSS
  • IOS
  • Android
  • PHP
  • MySQL
  • Other
  • Command line
  • NodeJs
  • Drupal 8
  • Drupal 7
  • GIT
  • DevOps
  • Python
  • Xampp
  • Server
  • Artificial intelligence
  • AppScript
  • Windows

Recent content

  • ERROR: Cannot create symbolic link : A required privilege is not held by the client.
    3 hours 33 minutes ago
  • Differences Between Bootstrap 3 & Bootstrap 4
    1 month ago
  • About Us
    1 month ago
  • Privacy Policy
    1 month ago
  • Create a Virtual Host on Xampp in 5 steps
    3 months ago
  • How to setup Multisite in drupal 9
    9 months ago
  • How to creating a FOR loop and a WHILE loop in JavaScript
    9 months ago
  • Calculator program HTML & PHP
    9 months ago
  • Algothrim to create a web application
    9 months ago
  • 10 Git Useful Commands for Every Developer
    9 months ago
© Copyright 2017 - 2026 key2Goal. All Rights Reserved