Using Flavors without giving over your whole domain

A few months ago I set my wife up with a Flavors landing page for her web site. She wanted to have her home page be more of a calling card and demote her blog just a bit, since she doesn’t post as often. I’m in the same boat, really, so I did the same for me yesterday. I wanted the new landing page to be reachable at “bradchoate.com” and not a subdomain like “portfolio.bradchoate.com”, so I elected to relocate my existing blog and site content to “blog.bradchoate.com”.

Of course, this broke everything. To use a custom domain with Flavors, you have point your domain’s DNS record to an IP address they give you. Once you do that, you can’t route paths for links within your web site any longer. And Flavors gives you little control over how those links are handled: either they can give a 404 (“page not found”) error, or they can redirect anything they don’t recognize back to your Flavors page. And we all know, good permalinks never die.

So, one way around this is to use mod_proxy. This is an Apache module that can be enabled for just this purpose. Here’s the config I added to my VirtualHost entry:

ProxyPreserveHost On
ProxyPassMatch ^/$ http://184.73.237.244/
ProxyPassMatch ^/(bradchoate/.*)$ http://184.73.237.244/$1
ProxyPassReverse / http://184.73.237.244/

I’m using ProxyPassMatch so it is only enabled for the matching paths. If you just use ProxyPass, all paths underneath your site will be sent to Flavors, and that defeats the purpose. ProxyPreserveHost forwards my “bradchoate.com” hostname on to Flavors, so they know which account to serve (mine, versus someone else’s). The second ProxyPassMatch was needed for their mobile interface. If you use this technique, just change “bradchoate” in that rule to your Flavors account name.

With these rules in place, everything seems to be working like I want. All of the Flavors page functionality is working like it was, and the rest of my web site is accessible to serve any links that exist on other sites.

I wish Flavors had better options for redirection; it would make it easier for their users to pass old links to a subdomain. In the end though, I prefer this solution myself. I don’t have to give up my domain and if I choose to stop using Flavors, there’s little to disconnect.

About

This article was published on April 26, 2013 8:05 AM.

The article previously posted was Picking up the pieces.

The next article is Catching up.

Many more can be found on the home page or by looking through the archives.

Powered by Movable Type