Create & Setup Virtual Host in Windows with XAMPP Server

I recently install and setup the XAMP server to running a laravel project in windows 10 but I don’t know how to create and setup virtual host in windows. I search in google but more websites share their valuable tips but I have added my own ideas because I have already running Apache2 and their in Ubuntu configuration virtual host is very easy.

I have already mention virtual host setup in Ubuntu in this blog. But today If you have issue to setup the virtual host then we will show you step by step easy way how can you setup virtual host in your windows Even if its window 10, 7 or 8. You need to change only two files lets check which are these.

Running laravel project in browser we use php artisan serve command but its not working proper in laptop I think I checked its going issue, so virtual host is very best to running any project even if its laravel, codeigniter or any else php framwork or cms like wordpress you can easily setup once and run multiple projects adding paths in your vhosts file. So lets start to creating virtual hosts…

Step 1: Update XAMP Virtual Host File

First, go to C:/xampp/apache/conf/extra directory

Then open your httpd-vhosts.conf just right click and edit your text editor which you are using. Now update your project path and add server name same like below image. I have added two projects here and added you can use your project name wise.

Note: remove hash (#) from virtual host starting and ending line.

I already explain about vitual host is here. We use these for this

VirtualHost: Mostaly all web servers use port 80 as their default port. However, you can change the port to 8080, 8081, etc.
DocumentRoot: The folder where files of a site will exist. In our case, the folder name is “laravelproject”.
ServerName: It is the URL for our virtual host. (laravelproject.co)
ServerAdmini: Not need to updating this.

Step 2: Update your Window Host File

Now you need to update your window hosts file, Go to C:\Windows\System32\drivers\etc\hosts.

Next, right click hosts and you seed just like below image. Here you need to add the server name same as which we already added in xamp vhost file. See the image below.

After adding this successfully now run the apache server. Opening this file you go to window search and type xamp control panel.

Once you are done, check opens up in your browser and run laravelproject.co and see you this.

Congratulations! You are now add more then projects in your Apache and window hosts files and run easily in browser. So friends create and setup Virtual Hosts for laravel or wordpress with XAMPP running on Windows 10 is completed. I hope you enjoy with this article. If you have any queries or suggestions, feel free to ask me via the comment section below. Feel free to follow codingdriver in social networks, I you have any post or want to update something else feel free to share us.

1 thought on “Create & Setup Virtual Host in Windows with XAMPP Server”

Leave a Comment