Freelance PHP Developer | Freelance PHP Programmer | PHP Freelance | Freelance Developer | PHP Freelancer | PHP Freelance Developers | PHP Developers | Freelance Developers | PHP Developer

[PHP] Setup Multiple Virtual Hosts in WAMP/XAMPP


WAMP and XAMPP are the popular server for developing web application with PHP/MYSQL in Windows environment. Generally we are working with different projects of clients. All projects folder exists in root directory of WAMP/XAMPP. Now whenever we move the project to production environment, we have to change tje absolute path manually. You have an option of Virtual Host if you dont want to change it manually. You can set your live URL instead of localhost with Virtual Hosts. You can setup as many Virtual Host as you want. For setup multiple Virtual Host, follow the below steps.

1. Host File Changes
- Open c:\windows\system32\drivers\etc\hosts
- You can see something like this. localhost
- This maps IP Address to localhost. Place your name below this line.
- For e.g.
- Add as many as you want [each in new line].

2. Apache Config File
- Open C:\wamp\bin\apache\apache2.2.6\conf\httpd.conf
- Find DocumentRoot ‘c:/wamp/www’
- Add below code under above line

ServerName localhost
DocumentRoot ‘C:\wamp\www’
DocumentRoot ‘C:\wamp\www\rakshit\programmingfacts’

You are Done.

Note: For XAMPP, you can find the httpd.conf file in different path. Please find it somwhere under apache and bin folder.

You can leave a response, or trackback from your own site.
    PHP Freelance | Freelance Developer | PHP Developer | PHP Freelancer | Freelance Developers | PHP Developers
    Freelance PHP Developer