Multisites url format

Events happening in the community are now at Drupal community events on www.drupal.org.
pyxio's picture

Greetings,

I was wondering if anybody here can share some advice on how to accomplish a specific URL format that I'd like to use. I have no problem setting up sites with subdomain names like;

red.example.com
white.example.com
blue.example come

However, what I'm looking for is this:

example.com/red
example.com/white
example.com/blue

I am confused as how to setup my httpd-vhosts.conf and properly name my multisite directories to achieve this. I'd be grateful for your help. Thanks! Kevin

Comments

Hm, subdirectory multisites...

shrthnd's picture

Create a symlink in the root of your Drupal installation. Point this at itself:

/drupal/[your site name] -> /drupal

Elsewhere: http://drupal.org/node/281574, http://drupal.org/node/53705

As I understand, symlinks are

pyxio's picture

As I understand, symlinks are OS based. So if my localhost WAMP development environment is Windows 7 and my production environment is UNIX I will have have issues using symlinks, won't I?

Issues

shrthnd's picture

I've never dealt with moving symlinks before (usually just migrate one site at a time, creating links from scratch) but I recall reading somewhere that they aren't nearly the same thing on Windows as they are on Unix. It's relatively easy on both platforms, though, so I wouldn't sweat it.

Unix, "ln" command: http://en.wikipedia.org/wiki/Ln_%28Unix%29
Windows 7 has the mklink command available from the command prompt. See: http://www.howtogeek.com/howto/windows-vista/using-symlinks-in-windows-v...

Let me know if I've been too vague or you have any specific problems.

In case you or anyone else is scratching their head searching for information on doing what you've described, the key phrase is "subdirectory multisite".

Joe

From D7 Settings.php

davidwheelerphd's picture

I have not done this; but, it looks like you just name your directories to:
/drupal/sites/example.com.red
/drupal/sites/example.com.white
/drupal/sites/example.com.blue

D7 Settings.php file. (Should work the same in D6)----------------------------------------------
For example, for a fictitious site installed at
* http://www.drupal.org/mysite/test/, the 'settings.php'
* is searched in the following directories:
*
* 1. sites/www.drupal.org.mysite.test
* 2. sites/drupal.org.mysite.test
* 3. sites/org.mysite.test
*
* 4. sites/www.drupal.org.mysite
* 5. sites/drupal.org.mysite
* 6. sites/org.mysite
*
* 7. sites/www.drupal.org
* 8. sites/drupal.org
* 9. sites/org
*
* 10. sites/default

Thanks David, Does this mean

pyxio's picture

Thanks David,

Does this mean there is no virtual hosts settings or symlinks necessary? Seems to good to be true!

Try it!

davidwheelerphd's picture

These two articles suggest you might have to use symlinks depending on the webhost you use but suggest you try it without the symlink first.

http://drupal.org/getting-started/6/install/multi-site (Near bottom of page.)
http://drupal.org/node/540262 (In middle of page.)

no vhost configuration is

jaxxed's picture

no vhost configuration is necessary if using subfolders. All multisites in this installation can run off of the same vhost configuration, pointed to the drupal base.

Drupal does the multisites by folder trick on it's own by looking at the full request path.

Relevant files are:
.htaccess - tells drupal the root directory, and passes the rest as the q= $_GET variable;
boostrap.inc - function conf_path($require_settings = TRUE, $reset = FALSE) - this guy tries to determine what sub-site to us, or uses the default if it can't figure anything out.

Multisite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: