There are two steps:
- Edit computer's hosts file
- Edit the Apache configuration file to accept Virtual Hosts and define the particular Virtual Hosts you want to setup on your computer.
1. Edit computer's hosts file
Open you computer's hosts file.
For Windows ( XP, Vista, Windows 7 32 bit, Windows 7 64 bit)
C:\windows\system32\drivers\etc\hosts.
At the end of file, add
127.0.0.1 YOURDOMAIN.local
with 127.0.0.1 is IP address that point back to computer ( just like it says me ). and YOURDOMAIN.local is the domain name that you want to declare. anything you want such as test.local, mysite.local, etc...
2. Edit the Apache configuration file
Open httpd-vhosts.conf in extra folder of apache. For WindowsC:\xampp\apache\conf\extra\httpd-vhosts.conf
Add the followings at the bottom of file :
NameVirtualHost *:80 <virtualhost *:80> DocumentRoot "C:/xampp/htdocs/" ServerName localhost </virtualhost> <virtualhost *:80> DocumentRoot "Your_folder_path" ServerName YOURDOMAIN.local </virtualhost>Save file and restart apache server. Done !