masthead image

Technology Blog

Drupal Multisite Gotchas

Tuesday March 3 2009, 01:24 AM

When you are running multisites under a Drupal installation you have to be careful of certain things. Here are some "gotchas" that you should be aware of.

Redirection Rules

There maybe times when you have to do a 301 redirect if you reorganize your website. This gotcha happened to us when we tried to re-architect our file hierarchy.

One of the sites we have is kerryonworld.com, a social networking website. We wanted to move our about, privacy, and terms of use pages under the kerryonworld taxonomy category so we went to the .htaccess file on the root to do the following:

Well it so happens this was an error. The problem is that kobashicomputing.com just so had the same URL signatures. So whenever we went to the footer of this site and clicked on those links, it took us to kerryonworld.com!

The solution of course was to do the following:

RewriteRule ^kerryonworld.com/about$ http://www.kerryonworld.com/kerryonworld/about-kerryonworld [R=301,L]
RewriteRule ^kerryonworld.com/privacy-policy$ http://www.kerryonworld.com/kerryonworld/privacy-policy [R=301,L]
RewriteRule ^kerryonworld.com/terms-of-use$ http://www.kerryonworld.com/kerryonworld/terms-of-use [R=301,L]

Per instance file locations

When you create a Drupal multisite you should be aware of the sites directory. Each directory corresponds to each website, the default, and to all websites:

/sites/all
/sites/site1.com
/sites/sites2.com
/sites/default

It is best that for each website you place unique content in each folder. So for example if you have video, images, and other resources that are part of only one website, then you should organize your site architecture per website on the sites directory:

/sites/all
/sites/all/images
/sites/all/video

/sites/site1.com
/sites/site1.com/images
/sites/site1.com/video

/sites/sites2.com
/sites/sites2.com/images
/sites/sites2.com/video

/sites/default

You should do it this way instead of this:

/site1.com/images
/site1.com/video

/site2.com/images
/site2.com/video

Rewrite your base

If you create your Drupal installation off the /drupal directory, don't forget you need to set our RewriteBase.

RewriteBase /drupal

If you create your Drupal installation off the root directory, you set the Rewritebase as follows:

RewriteBase /

If you don't want to go through the hassle of figuring out if your host meets Drupal requirements and wasting time troubleshooting, use Hostgator. This site happens to be on HostGator and is running Drupal multisites. I've used them throughout the years and they are affordably priced and very good on support.

Note: If you signup using Hostgator use the banner above. Please also contact me if you have done so to let me know.