How To Create Virtual Host In Xampp Windows ?

Windows

Nicesnippets

5468

11-11-2020


In this article, I am going to learn you how to create virtual host in xampp windows. We will will get how to create or the setup virtual host in windows. i will show how you can setup and configure virtual hosts for drupal website with XAMPP running on windows. This tutorial will give easy and simple way to create or setup virtual host in xampp windows.

Here i will give you full example for how to create & setup virtual host in windows with XAMPP Server step by step easy way configuration vhost in your windows So let's follow bellow step by step.

Step 1 : Create Virtual Host


In this step, You can open C:/xampp/apache/conf/extra/httpd-vhosts.conf file Then, edit httpd-vhosts.conf with any text editor. In my case, I am using Notepad++.

Now put the bellow code at last in this file.

C:/xampp/apache/conf/extra/httpd-vhosts.conf

<VirtualHost *:80>

DocumentRoot "c:/xampp/htdocs/my_pro" // Your Project Folder Path

ServerName my_pro.localhost

<Directory "c:/xampp/htdocs/my_pro"> // Your Project Folder Path

</Directory>

</VirtualHost>

  • VirtualHost: Most web servers use port 80 as their default port. However, you can change the port to 8080, 8081, etc.
  • DocumentRoot:  add your project folder path, my folder path is c:/xampp/htdocs/my_pro.
  • ServerName: It is the URL for our virtual host.
  • Directory: It is the directory of our virtual host.

Step 2 : Add Host

In the last step, we will open C:\Windows\System32\drivers\etc\hosts

File and add your servername at the end of file.

127.0.0.1 my_pro.localhost

Now run your xampp server and start your apache and mysql service. Then open your browser run your project.

my_pro.localhost

It will help you...


Recommended Posts