Home  >  Article  >  Backend Development  >  How to Create Virtual Hosts on XAMPP?

How to Create Virtual Hosts on XAMPP?

Barbara Streisand
Barbara StreisandOriginal
2024-10-27 02:56:03137browse

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:WINDOWSsystem32driversetc 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 xamppapacheconfextrahttpd-vhosts.conf and add the following block:

    <VirtualHost *:80>
      DocumentRoot "C:/xampp/htdocs/[Host Domain Path]"
      ServerName [Host Domain Name]
    </VirtualHost>

3. Uncomment Virtual Host Module

  • In xamppapacheconfhttpd.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.

The above is the detailed content of How to Create Virtual Hosts on XAMPP?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn