Settings for virtual host in Apache

Step 1 : DNS
open below file in your editor
in above folder we need to open hosts file and then add your new DNS
for example,

Step 2 : Setting for xampp
Now open
open this file httpd-vhosts.conf
and then we need to create our virtual host
for exmaple,

first we need to define our default localhost

NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin localhost
DocumentRoot “c:/xampp/htdocs/”
ServerName localhost

and then we need add one more host

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot “c:/xampp/htdocs/proejctname”

Last step we need to restart apache and then we can open our site as we defined in DNS


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s