Create Virtual host for Apache on Windows 10 by Using XAMPP.

Ahmed Thaajwer
D6 Digital
Published in
3 min readFeb 23, 2019

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.

STEP 01

First, you have to stop apache server in XAMPP control panel.

STEP 02

Then,you need to go C:\xampp\apache\conf\extra

Then,edit httpd-vhosts.conf with text editor. Here i edit with notepad++

STEP 03

After editing with text editor you will see like this.

STEP 04

Then uncomment the NameVirtualHost *:80 ,

STEP 05

Then, go to the down of the page and copy following code and paste it.

ex:

<VirtualHost *:80>
DocumentRoot “C:\xampp\htdocs\D6-Technology”
ServerName www.d6technology.lk
<Directory “C:\xampp\htdocs\D6-Technology”>
Require all granted
</Directory>
</VirtualHost>

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…

STEP 06

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,

127.0.0.1 [ServerName]

Ex: here i am using my server name as www.d6technology.lk

127.0.0.1 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

Ex: ‘^www\.d6technology\.lk$’,

Important: Then go to the Xampp control panel and start apache server.

STEP 07

Once you are done, check whether by browsing your servername URL(www.d6technology.lk)

--

--

Ahmed Thaajwer
D6 Digital

B.Sc.(hons) in Computing & Information System(SUSL). Former Software Engineer@D6 Digital. IEEE Brand Ambassador@IEEE. Regional Country Director@UYG.