Developer News, More

xampp virtual host configuration


How you will configure or setup xampp virtual host ?

Well this is very common to use virtual host at your local development environment. Sometimes you want to develop your site with a domain on your local machine. Its very easy with xampp virtual host.

Some times developer are facing problem to enable virtual host on xampp. At this article I will show you how to configure xampp virtual host. As you are on this post I am thinking you as a developer or at-least you know about xampp very well.

To configure xampp virtual host you need to change httpd.conf file from the following location

Make sure you will find XAMPP at the directory where you install it.

Just open httpd.conf file on your favorite Editor and go to the line number 488 , You will find something like

Just remove # tag before the include tag. So the changes code will be looks like

After that restart your apache server.

Now go to the following directory bellow and open the file named httpd-vhosts.conf

and then remove everything bellow 22 may be started with

Now the file will looks like the following image bellow

xampp virtual host

So there will be only comment in the file. Now we will add our configuration for each virtual host. Like if we need to set a domain with a specifiq directory like and the directory will be /Users/name/mysite

Then you have to write following configuration in httpd-vhosts.conf


After doing that just restart your apache. You are not fully done. Now you have to edit your host file. Do the following to edit your host file ..

For Mac user :

  • Double-click Terminal.
  • type sudo nano /etc/hosts then hit return.
  • You’ll be asked for your password. Enter your admin password

After that you will find your host file. Go to bottom and add your ip with domain.

Like if your ip is and your domain  which you configured on httpd-vhosts.conf then you should add like this

Read details about editing host file on mac from here

For Windows User :

  1. Click Start Start button , click All Programs, click Accessories, right-click Notepad, and then click Run as administrator. User Account Control permission If you are prompted for an administrator password or for a confirmation, type the password, or click Allow or Yes.
  2. Open the Hosts file or the Lmhosts file, make the necessary changes, and then click Save on the Edit menu. If using Windows 7, you will need to click Save on the File menu.

For Linux user :

  • Open a terminal window.
  • Open the hosts file in a text editor (you can use any text editor) by typing the following line:
  • sudo nano /etc/hosts
  • Enter your domain user password.
  • Make the necessary changes at described for mac user.
  • Press Control-x.
  • When asked if you want to save your changes, answer y.

Check Details about editing host file

After doing all this just open your browser and type and it will show content from the desire directory you configured.

Hope it will help you get separe domain address for each project. So we had successfully configured our xampp virtual host.

If you like this post then don’t forget to share the post.

Thanks for your time.

You Might Also Like

Leave a Reply