


[Transfer] Configure multiple websites in XAMPP, configure multiple xampp_PHP tutorial
Jul 13, 2016 am 09:46 AM[Transfer] Configure multiple websites in XAMPP, configure multiple xampp
XAMPP virtual host configuration, bind multiple domain names to access local sites
XAMPP Sometimes you need some top-level domain name access methods to access your local project, which is the virtual host configuration. At this time, you need to configure the virtual host and bind a domain name to your directory to achieve multi-domain binding. access.
I have always used MAMP to build a local php environment on Mac because of its powerful combination configuration and convenient UI operation. Because the company's computers are Windows, sometimes you need to set up a PHP environment to debug some small things to facilitate your work. Since it is just a small application, there is no need to build a local WAMP environment by yourself. There are still many WAMP environment integration packages online. I have never used PHPNow, WampServer, PHPStudy, AppServ, EasyPHP, etc., and UniServer, which I have been using before, is so dazzling that I am dazzled. I actually don’t know the reason why I didn’t use UniServer later. UniServer is very powerful and worth recommending, but then I switched to XAMPP because it is also very powerful and the file package is more than 100MB. Of course, you can download the Lite version. , but the file size is several times larger than UniServer. Maybe it was because of its size that I later switched to XAMPP.
Sometimes you need some top-level domain name access methods to access your local project files instead of directory access. In this case, you need to configure a virtual host and bind a domain name to your directory. (If you are local, you can bind any domain name such as www.a.com or localdemo by modifying the hosts file).
Now assume you have two directories, one exists in /xampp/htdocs/a and the other exists in /xampp/htdocs/b.
Now when you want to access www.a.com for local testing, the corresponding directory is /xampp/htdocs/a, and the corresponding directory for accessing www.b.com is /xampp/htdocs/ b.
If you know how to configure Apache, you can actually avoid it, because XAMPP is nothing more than integrating environment integration packages such as APache, and implementing multiple domain names is achieved by configuring Apache.
Of course, there are many methods that can be found online, but the information on the Internet is reprinted and reprinted. I doubt whether some methods have been verified or not and I don’t know whether they are correct. The following method was personally tested by me. If you still cannot achieve local multi-domain debugging according to my configuration, it may be because your XAMPP version is inconsistent with mine. You can tell me in the comments below and I will answer it for you. The following configuration is for XAMPP Windows 1.7.1 version.
1. First modify the hosts file in the WINDOWSsystem32driversetc directory on the C drive, open it with Notepad, and add:
(added at the end of the file)
127.0.0.1 www.a.com
127.0.0.1 www.b.com
2. Open the xamppapacheconfhttpd.conf file, search for "Include conf/extra/httpd-vhosts.conf", and make sure there is no # comment in front, that is, make sure the vhosts virtual host configuration file is introduced .
When httpd-vhosts.conf is enabled, the default httpd.conf default configuration becomes invalid (make sure the virtual host configuration is also enabled in the httpd-vhosts.conf file, see Article 3), Domain names accessing this IP will all point to the first virtual host in vhosts.conf. (Note that it is the first one, see Chapter 4 for details)
3. Set in the virtual host setting file xamppapacheconfextrahttpd-vhosts.conf:
Cancel NameVirtualHost *:80 The ## in front of this will enable vhosts.conf, and the default httpd.conf default configuration will be invalid. Virtual host configuration will only be set in httpd-vhosts.conf.
DocumentRoot /xampp/htdocs/a
ServerName www.a.com
DocumentRoot /xampp/htdocs/b
ServerName www.b.com
4. After setting up item 3, you will find that access localhost points directly to the path set as a. This issue is discussed in Article 2. That is to say, after vhosts is enabled, the default httpd configuration will become invalid, and the default access will point to the first setting in vhosts. At this time, you need to set back the localhost directory configuration.
DocumentRoot /xampp/htdocs/
ServerName localhost
At this point, the XAMPP virtual host is set up. Now access localhost or the original XAMPP help guide. Access www.a.com will point to the bound a directory, accessing www.b.com will point to the bound b directory.
----------------------------------------- ------------------------------------------
Instance reference:
XAMPP adds VirtualHost to support multiple sites
Add the following content in the c:xamppapacheconfextrahttpd-vhosts.conf file:
NameVirtualHost *:80
DocumentRoot "E:/php/wordpress"
ServerName wordpress
(This paragraph must be added, otherwise it will be inaccessible)
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Directory>
(This paragraph returns the localhost default access setting and must be placed at the end)
DocumentRoot "D :/xampp/htdocs/"
ServerName localhost
In the C:WINDOWSsystem32driversetc directory Add the following content to the hosts file:
127.0.0.1 wordpress
Place the file httpd-vhosts.conf:
#NameVirtualHost *:80
Just remove the #

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

Title: Computer configuration recommendations for building a high-performance Python programming workstation. With the widespread application of the Python language in data analysis, artificial intelligence and other fields, more and more developers and researchers have an increasing demand for building high-performance Python programming workstations. When choosing a computer configuration, in addition to performance considerations, it should also be optimized according to the characteristics of Python programming to improve programming efficiency and running speed. This article will introduce how to build a high-performance Python programming workstation and provide specific

In the technical field, XAMPP is a commonly used development environment tool. It integrates software such as Apache, MySQL, PHP and Perl, and can help developers quickly build a local server environment. However, sometimes when using XAMPP, you will encounter PHP execution exception problems, which may cause problems in development work. This article will share some troubleshooting techniques to help readers solve the problem when XAMPP encounters PHP execution exceptions. 1. Check the PHP error log. First, when the P in XAMPP

The solution to the problem that XAMPP cannot execute PHP is revealed. Specific code examples are needed. XAMPP is a very commonly used integrated development environment tool during website development or local testing. However, sometimes during the installation and configuration of XAMPP, you may encounter the problem that XAMPP cannot execute PHP, resulting in the website being unable to run normally. This article mainly provides a detailed introduction to the solution to the problem that XAMPP cannot execute PHP, including specific code examples. I hope it can help people who encounter similar problems.

Top 10 virtual currency trading platforms in the 2025 cryptocurrency circle: 1. OKX, known for its high liquidity, low fees and abundant products; 2. Binance, one of the world's largest exchanges, with a huge user base; 3. Gate.io, a veteran exchange, safe and stable; 4. Kraken, focusing on professional traders, safe and compliant; 5. Huobi Global, a world-renowned, strong technical strength; 6. Coinbase, a leading exchange in the United States, easy to use compliance; 7. KuCoin, rich trading pairs, low fees.

Top 10 digital currency trading app platforms: 1. OKX, 2. Binance, 3. Gate.io, 4. Huobi, 5. Coinbase, 6. Kraken, 7. Bitfinex, 8. KuCoin, 9. Bybit, 10. Bitstamp, these platforms provide real-time market trends, technical analysis tools and user-friendly interfaces to help investors conduct effective market analysis and trading decisions.

Magnet Dog is a magnet link search engine that can quickly search for magnet link resources across the entire web. Users can search by keywords to quickly find the magnet links for the movies, TV series, music, software, games and other resources they need, and download them through the magnet links. Next, let the editor introduce you to the Magnet Dog website and Magnet Dog. How to use it! 1. Magnetic Dog Website Magnet Dog is a clean and easy-to-use search engine for magnetic links and network disk resources. Through in-depth mining and sorting of resources such as magnetic links and Baidu network disk, we can obtain resource information more quickly and equally. The interface logo style of the official website of Magnet Dog is similar to that of the official website of Magnet Cat. Its powerful search function aggregates film and television resources across the entire network, and provides all seed links at once, making intelligent search easy.
