Has anyone successfully implemented multiple hosts locally with Drupal 4.6?
I'm running Apache on Linux and can't seem to find the magic config.

My main site is http://localhost. It works fine.
I want a second site, either foo.localhost or localhost/foo.

I've tried creating new sites directories (localhost.foo or foo.localhost) with the appropriate settings.php file. I've tried adding virtual hosts in http.conf, nothing seems to work.

Thanks for any suggestions.
-JD

Comments

Uwe Hermann’s picture

Yes, this works like a charm. Just install a second Drupal in a subdirectory (e.g. foo). There, edit $base_url in settings.php to read "localhost/foo" and adjust the .htaccess file to say "RewriteBase /foo". That should work.

Uwe.
--
hermann-uwe.de | crazy-hacks.org | unmaintained-free-software.org

sepeck’s picture

you may need to add an entry in your local HOSTS file to point foo.localhost to your local IP Address. If you browser doesn't know where to resolve the name, then it won't get there.

-sp
---------
Test site...always start with a test site.
Drupal Best Practices Guide

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

univie’s picture

It is easy!
first add a fake directory with symbolic links in your drupal home directory (e.g. /usr/local/www/drupal)

>ln -s . foo

then go to drupal/sites and add a subdirectory /sites/yoursite.com.foo

copy file settings.php to this directory and edit it. give appropriate mysql-database etc. etc. (before you should create that mysql-database)

then go to http://yoursite.com/foo

there it is!

in the same way you can add additional site on the same codebase

jdlilly’s picture

Thanks for the suggestion. I mistakenly thought the symbolic link step was no longer needed in 4.6. Adding that made it work.
-JD

schalker’s picture

I have set up a test environment with XAMPP on my Windows machine as in http://drupal.org/node/21203 .

Unfortunately, I cannot do the trick as you mentioned: It seems that linking a directory does not work the same way as on a UNIX machine. Is there a work-around available?

sepeck’s picture

I can do it with IIS with Virtual hosts. You just point them to your root Drupal directory. You can do linking in Windows XP/2003 but its a resource kit utility and am unsure how it would work in Apache.

-sp
---------
Test site...always start with a test site.
Drupal Best Practices Guide

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide