How to make a virtual host on apache and how to make virtual hosts for drupal multisite

Posted by: 
Dominique De Cooman

Go to windows host file (C:WindowsSystem32driversetchosts) and add :
Or on linux go to /etc/hosts and add
127.0.0.1 name_of_your_host

Go to the httpd.conf file in appache and add :

NameVirtualHost *:80
<VirtualHost *:80>
  ServerName name_of_your_host
  DocumentRoot "C:wampwwwname_of_your_host"  //or whatever the path to your host is
</VirtualHost>

If you want a drupal multisite for example

main_folder/sites/site_1
main_folder/sites/site_2
 
//add
<VirtualHost *:80>
  ServerName site_1
  DocumentRoot "C:wampwwwmain_folder"
</VirtualHost>
 
<VirtualHost *:80>
  ServerName site_2
  DocumentRoot "C:wampwwwmain_folder"
</VirtualHost>

On linux restart appache with command: apachectl restart
On windows restart with the icon

Add new comment