update 5/5/2020 This site no longer works this way.  Everything works but I made changes for branding purposes.


So for years, in addition to what I do for clients, I've managed 5 sites for myself 4 of them public, 1 private:

Until 2 weeks ago, I've been hosting them on a server at Linode. I enjoyed using their services and things were stable for cloud hosting.  I just got to a point that I didn't want to be in the server management business anymore. I had success with Pantheon for a number of clients and have been recommending them.  I decided I'd take my own advice and move all my personal sites there. I temporally set them up as separate containers in their infrastructure.  There were 2 issues:

  1. I'd like to minimize the time I spend deploying security / maintenance updates to my sites.
  2. I wanted to minimize my costs.  None of my sites are highly trafficked so, there was really no need to have this live in live separately.


Just merging the sites into a single domain with a separate domain wasn't something I was interested in doing. It may be the gemini in me, but I like that each of my interests have a different  look and feel and live under their own domain.

Using a Drupal multisite setup wasn't an option because it's not supported by Pantheon.  Additionally, I'd still be performing security and maintenance updates to 5 sites so I wouldn't save any time.

Drupal has the domain access module.   This was a contender for a bit,  The problem was that were domain access does a number of cool things it was overkill for my use case.  I didn't want to bloat my codebase with that much functionality I was never going to use.

Finally I decided I would wire it manually.

Separate Branding on Each Site

Like I said above, it was important for me to make sure that each of my sites had it's own look and feel.  To simplify things I wanted each site to have its own theme.  I'd use the path of the URL to determine which theme to use.

Drupal 7 had the themekey module which hasn't been ported to Drupal 8.  Thankfully the switch page theme module does pretty much the same thing.


Separating Each Site's Content

In order to separate each site I have a taxonomy term "site" to determine which site a piece of content goes to.  I have a pathauto rule setup to create aliases for each for each site:

  • /blog for the blog
  • /professional for freelance drupal
  • /photography for photography

This allows me to redirect based on url.

Redirecting Content in Settings.php

I decided to do the redirects in settings.php, so Drupal wouldn't need to bootstrap before redirecting. This code would do 2 things:

  • Redirect to the right homepage.  So seanreiser.photography get redirected to seanreiser.photography/photography.
  • Redirect to the right domain.  If someone goes to seanreiser.com/blog, you get redirected to bowtiesare.cool/blog.