Create Virtual host for Apache on Windows 10 by Using XAMPP.
Nowadays many developers, small businesses, and even large businesses rely on Apache to power their website on a daily basis. Apache was mainly designed to run on linux servers, but has since been ported to run on any operating system.So here we can use apache on windows operating system too.
In this blog, I am going to explain how you can setup and configure virtual hosts for drupal website with XAMPP running on windows 10.
First, you have to stop apache server in XAMPP control panel.
Then,you need to go C:\xampp\apache\conf\extra
Then,edit httpd-vhosts.conf with text editor. Here i edit with notepad++
After editing with text editor you will see like this.
Then uncomment the NameVirtualHost *:80 ,
Then, go to the down of the page and copy following code and paste it.
Require all granted
DocumentRoot: The folder where files of a site will exist. in this case my drupal site folder name is D6-technology.
ServerName: This is the URL for our virtual host.i am using my url as www.d6technology.lk
Directory: This is the directory of our virtual host.
Then save that folder…
Then you need to go C:\Windows\System32\drivers\etc , It look something like this.
Then edit the hosts file in your text editor.it look like this.
At the bottom of the file just type,
Ex: here i am using my server name as www.d6technology.lk
Then save hosts file.
Note FOR Drupal Virtual Host:
C:\xampp\htdocs\D6-Technology\sites\default go to this path in your drupal site ,check whether there is a setting.php file.if it is you have to change like this.
In the bottom of the folder you have to add this code => ‘^www\.example\.com$’, →server name
Important: Then go to the Xampp control panel and start apache server.
Once you are done, check whether by browsing your servername URL(www.d6technology.lk)