How to Setup a Lighttpd Feedburner Redirect

Jul 14, 2006

I’m finally getting enough people visiting MyersDS for the articles that I’ve setup an account with Feedburner. This will get some feed stats to compliment the regular page stats.

The one problem that presented itself to me is the common issue that if you just provide your readers the direct link to your feedburner feed then you’re effectively locked into the service, since that is the link all your readers will be using. A better solution is to set up a redirect from your old feed so that the change over will be transparent to everyone (both current and new readers).

The Lighttpd Config

First you need to add this to your Lighttpd config so the setup config for your site looks like so:

$HTTP["host"] =~ "(www.)?yourdomain.tld" {                     
  #handle Feedburner redirect so we're not locked into that service
  $HTTP["useragent"] !~ "FeedBurner" {
   url.redirect = (
     "^/path-to-feed/feed.xml" =>
     "http://feeds.feedburner.com/your-account" 
   )
  }

  [ rest of config goes here as usual ]
}

The other crucial part is to add “mod_redirect” to your server.modules list. If you don’t you’ll get an error message when you restart Lighttpd.

Final Notes

It’s really that easy, and it gives you the stat tracking benefits of Feedburner while at the same time giving you the freedom to go back to your regular old feed if needed with minimal hassle.