"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How to Create Virtual Hosts on XAMPP?

How to Create Virtual Hosts on XAMPP?

Posted on 2025-02-06
Browse:590

How to Create Virtual Hosts on XAMPP?

Creating Virtual Hosts on XAMPP

To create virtual hosts on XAMPP, follow these steps:

1. Update Hosts File

  • Navigate to C:\WINDOWS\system32\drivers\etc\ and open the "hosts" file.
  • Add the following entries:

    127.0.0.1       localhost
    127.0.0.1       [Host Domain Name]

2. Configure Virtual Host

  • Open xampp\apache\conf\extra\httpd-vhosts.conf and add the following block:

    
      DocumentRoot "C:/xampp/htdocs/[Host Domain Path]"
      ServerName [Host Domain Name]
    

3. Uncomment Virtual Host Module

  • In xampp\apache\conf\httpd.conf, scroll to the Supplemental configuration section and uncomment the following line:

    #Virtual hosts
    Include conf/extra/httpd-vhosts.conf

    4. Restart XAMPP and Access Virtual Host

Restart XAMPP and access the virtual host in your browser by entering the Host Domain Name as the website address.

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3