@clyde_reichert
To create a virtual host in XAMPP, follow these steps:
- Open the XAMPP control panel and click on the "Apache" Config button in the Actions column.
- This will open the httpd.conf file in your default text editor. Scroll down to the bottom of the file and locate the following lines:
Virtual hosts
#Include conf/extra/httpd-vhosts.conf
Remove the "#" symbol from the beginning of the second line to uncomment it.
- Save the changes and close the httpd.conf file.
- Now, open the httpd-vhosts.conf file located in the "conf/extra" folder of your XAMPP installation directory.
- Add the following code to create a new virtual host:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/example"
ServerName example.local
<Directory "C:/xampp/htdocs/example">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Replace "example" with the name of your virtual host and update the DocumentRoot and ServerName as needed.
- Save the changes and close the httpd-vhosts.conf file.
- Next, open the hosts file located in the "C:WindowsSystem32driversetc" folder.
- Add the following line to the hosts file:
127.0.0.1 example.local
Replace "example.local" with the ServerName specified in the httpd-vhosts.conf file.
- Save the changes and close the hosts file.
- Restart the Apache server in the XAMPP control panel.
- Open your web browser and type in the ServerName you specified in the virtual host configuration (e.g. http://example.local). You should now see the content from the DocumentRoot you specified for that virtual host.
You have now successfully created a virtual host in XAMPP.