For 95% of people out there, the FeedBurner FeedSmith plug-in is a great way to automatically redirect your feeds over to Feedburner’s tracking system.
The problem with the plug-in is it redirects ALL feeds over to one FeedBurner feed. If you’re like me (or others) and have a podcast with two different feeds for two different types of files (like audio and video, or MP3 and AAC), you can still use FeedBurner for stats tracking, but it takes some manual hacking.
Requirement: You must have edit access to a file called “.htaccess” in your Wordpress root directory and your web hosting provider must support redirects. Some web hosting companies, such as GoDaddy, intentionally obfuscate access to “.htaccess” or just plain disallow redirects from it, usually under the flimsy guise of “security concerns”. Your mileage may vary, so check with your web host provider if you have issues.
Disclaimer: There are multiple ways to skin a cat, so there may be better ways of doing this. This works for me on my provider. I can’t be responsible if you break your feed, unsubscribe all your listeners, kill a kitten, or cause Twitter more downtime using this method.
Using my podcast as an example, here’s what a basic redirect looks like. You would add these lines BEFORE the Wordpress code-block that usually starts with “# BEGIN Wordpress” or the like:
RewriteCond %{HTTP_USER_AGENT} !FeedBurner
RewriteRule ^feed(.*) http://feeds.feedburner.com/SufferingFromSanity [R=302,L]
Here’s how this is translated by the web server:
RewriteCond %{HTTP_USER_AGENT} !FeedBurner
This tells the web server that the rewrite condition we’re trying to perform only applies when the “user agent” isn’t “FeedBurner”. In other words, this rule only applies if we’re not FeedBurner. Side note, without this exclusion, FeedBurner rightly complains of a rather nasty circular reference trying to pull your feed.
RewriteRule ^feed(.*) http://feeds.feedburner.com/SufferingFromSanity [R=302,L]
This is the actual rule. It redirects the prefixed website (which covers someone typing in “sufferingfromsanity.com” or “www.sufferingfromsanity.com”) accessing “feed” with or without the trailing slash “(.*)”. It redirects that access to the FeedBurner address with an HTML 302 code. HTML 302 is called a “temporary redirect”, which means web spiders and search engines (like Google, Yahoo, etc.) won’t permanently replace “http://sufferingfromsanity.com/feed” with the FeedBurner in their indexes. The “L” tells the web server the rule has ended.
To do this for different Wordpress categories, just change the appropriate feed being redirected:
RewriteCond %{HTTP_USER_AGENT} !FeedBurner
RewriteRule ^category/podcast-main/feed(.*) http://feeds.feedburner.com/SufferingFromSanity [R=302,L]RewriteCond %{HTTP_USER_AGENT} !FeedBurner
RewriteRule ^category/podcast-enhanced/feed(.*) http://feeds.feedburner.com/SufferingFromSanityEnhanced [R=302,L]
When you set up FeedBurner, simply give it the regular feed to look at (e.g. “http://sufferingfromsanity.com/feed/”) and it should handle the rest. With this method, the number of available redirects is theoretically limitless — although if your “.htaccess” file gets really big it might bog down your site’s load times just a bit.
I hope you’ve found this useful. If you found a better or different way of doing this, feel free to leave a comment below.
Technorati Tags: Wordpress, Feedburner, redirect, category
One comment
Leave a reply