- 1 year ago
How to create virtual host in Xampp windows 10
To create a virtual host in XAMPP on Windows 10, you can follow these steps:
Edit the Hosts File: Open the hosts file on your Windows system. The hosts file is located at
C:\Windows\System32\drivers\etc\hosts
. Open the file with a text editor (e.g., Notepad) as an administrator. Add an entry for your virtual host by appending the following line at the end of the file:127.0.0.1 yourdomain.test
Replace
yourdomain.test
with the desired domain name for your virtual host.Configure Apache Virtual Host: Open the Apache configuration file
httpd-vhosts.conf
. The file is located in theapache\conf\extra
directory of your XAMPP installation directory (e.g.,C:\xampp\apache\conf\extra\httpd-vhosts.conf
). Add the following code to create a virtual host configuration:apache<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/your-folder"
ServerName yourdomain.test
<Directory "C:/xampp/htdocs/your-folder">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Replace
C:/xampp/htdocs/your-folder
with the actual path to your project folder.Restart Apache: Restart the Apache server in XAMPP to apply the changes. You can do this by opening the XAMPP Control Panel, clicking the "Stop" button next to Apache, and then clicking the "Start" button to restart it.
Test the Virtual Host: Open a web browser and enter
http://yourdomain.test
in the address bar. If everything is set up correctly, you should see your virtual host's content.
By following these steps, you can create a virtual host in XAMPP on Windows 10. This allows you to configure custom domain names for your local web development projects.