How I Multi-site on my localhost

Last modified: June 3, 2009 - 02:53

This will work on windows or unix environments

I want a local site with one install of Drupal that is on my local server (WAMP), and I want to be able to create multiple sites for development and theming. I spent hours searching the internet, reading posts, and combing forums. I tried many different ways and many different ideas, and just couldn’t find a solution that worked for me… one way or another something just wasn’t working, or something else stopped working… until now…

Disclaimer!!! I am no expert, but here’s what is working for me… and maybe it will work for you. Forget editing all of the config files an Apache and changing options… this is what I did and it works for me… wanted to share and see of I was doing any additional harm to my pc, Drupal, or WAMP (let me know if you see a problem).

The steps below assume that you got WAMPServer up and running correctly. That you have your databases created, phpmyadmin and mysql work... How to do that stuff isn’t here, this is after you have the basics all up and running…

Here’s the details…
I have installed Drupal in c:/wamp/www/drupal5 (also because I have a drupal6 directory so I can work with both 5 and 6).

In the c:/wamp/www/srupal5/sites folder I created the folder “mysite“ and copied over an original copy of settings.php into that folder.

Then I opened the host file in c:\windows\system32\drivers\etc\ (made a backup copy) and at the bottom it says: 127.0.0.1 localhost.

Under that like I just added 127.0.0.1 mysite

That’s it….

Now I navigate to http://mysite/drupal5 and I am using the folder called mysite in the drupal5 folder. So I now have several sites with one install… maybe it’s not the best or most proper way to do it… but I am happy with it and 2 days later… it’s still working…

Maybe it will work for you…..

If you want to go the next step and be able to access it from other computers in your network then the HOST file is again the place to be. But this time it's the HOST file on the PC doing the accessing... not on the machine hosting Drupal.

Because other machines have no idea where to look to find 'http://mysite/' you have to tell them also using the same kind of HOST hack trick. But THIS TIME the number they need is not 127.0.0.1, but the actual external IP of your host machine they are trying to connect to (eg maybe 192.169.0.2 (or something) if they are on your LAN).

I find my IP (run 'ipconfig' from XP cmd-line) on the computer doing the hosting (the one with all the additions so far)

Went to the computer I wanted to use to access that computer (hosting) and opened it's HOST file.

Then I added the IP number (that I got from the hosting computer)

Now this new machine knows where to look (on the hosting computer).

 
 

Drupal is a registered trademark of Dries Buytaert.