I spent a few hours friday working on a blog widget that would parse the number of subscribers out of the HTTP_USER_AGENT strings of the various feedreaders so I could easily see the aggregate number of subscribers I have. It only took me a few hours to realize that what I was trying to do, wasn’t gonna work.
My plan to use remote javascript may have worked fine for human readers to the main index, a la MyBlogLog (which I use), but of course, duh, the feedreaders won’t load the main index and they likely won’t interpolate the javascript. I doubted an iframe would work either.
So my idea for a widget wasn’t going to fly, I realized the only way to do this was to actually run the entire feed URL through the counter system, the way FeedBurner does it. It was only a coincidence that this happened on the same day Google bought FeedBurner for 100 Million.
So the blog widget is a non-starter, I still want to easily know my aggregate subscribers but now I don’t want to start counting from zero, I want to be able to factor in my existing readers.
My existing readers subscribe to my feed via http://mark.jeftovic.net/feeds/index.rss2, which is the same URL feedburner will use to load the feed. So simply redirecting my existing feed URL to my new Feedburner feed would create an infinite loop when FeedBurner tries to load the old feed.
We need to always redirect the old feed URL to the new feed URL except when the remote client is Feedburner.
My blog platform is serendipity, and it implements all the RSS and XML urls by a URL rewrite to rss.php, so at the very top of that file, we just add this:
if(!eregi("^FeedBurner",$_SERVER['HTTP_USER_AGENT'])) {
Header("Location: http://feeds.feedburner.com/jeftovic/JVMu");
exit;
}
This should allow Feedburner to load the RSS from the blog, and redirect all the other feedreaders to Feedburner. Hopefully I haven’t overlooked anything. This is somewhat of a test post and if all goes well, it should show up in my Bloglines reader transparently.
To migrate to FeedBurner from other blog platforms including WordPress and Drupal, there is this thread on the FeedBurner forums.