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. 127.0.0.1 localhost
- This maps IP Address to localhost. Place your name below this line.
- For e.g. 127.0.0.1 programmingfacts.com
- 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
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.