Redirecting WordPress Feeds to Feedburner
Written by Brian on December 6, 2008 – 7:30 pm -
Continuing my attempts to improve this site, I decided to embark on creating feedburner feeds for each sub-site. Then, I needed to re-direct my WordPress feed files to feedburner.
Turns out it wasn’t quite as easy as I hoped. There’s a WordPress plugin available to redirect your feed to Feedburner, but this only redirects the main feed and the comments feed. No dice for categories.
I found a few people suggesting an alternative: .htaccess rewrites. I never liked working with .htaccess, mostly because I never liked working with regex. But what are ya gonna do?
An .htaccess Alternative to the Plugin
I found an example of a .htaccess solution at Persihable Press.
For a full explanation, head over to the original article. But in the meantime, here’s the .htaccess code he suggested:
# temp redirect all wordpress feeds to feedburner RewriteEngine on RewriteCond %{REQUEST_URI} ^/?(feed.*|comments.*) [NC] RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC] RewriteRule ^feed/?.*$ http://feeds.feedburner.com/perishablepress [L,NC,R=302] RewriteRule ^comments/?.*$ http://feeds.feedburner.com/perishablepresscomments [L,NC,R=302]
As I understand it, this is more or less a three step process.
First, the regex catches all requests for a URI that includes feed or comments (i.e. your RSS feed). Then, it checks if the user agent is FeedBurner. The FeedBurner bot is allowed to access the original feed, but everybody else should be tossed over to the Feedburner site.
Finally, it sends the user to the appropriate Feedburner URL, based on the request URI.
Adding Category Feeds
That, of course, does the same thing as the plugin. It redirects the site feed and the comments feed, but it doesn’t help you redirect your categories.
For me, each parent category is like it’s own site, so that doesn’t help. I’d like you to be able to subscribe to the “Nerds at Work” feed about web development without being bored by all my ranting on education.
Luckily, somebody commented on the original article and left a suggestion as to how to redirect the category feeds. I used that to create my own .htaccess file, and everything seems to work hunky-dory.
You don’t need to re-write any of the conditions, because that regex will already flag the category feeds. All you need to do is add a few extra rewrite rules, based on the new URIs and provide the appropriate Feedburner URL.
In general, that rewrite rule should look like this…
RewriteRule ^category/nerds-at-work/feed/?.*$ http://feeds.feedburner.com/thislifeofbrian-work [L,NC,R=302]
Replace ‘nerds-at-work’ with your own category slug, and replace the full URL with the URL to your Feedburner feed.
I had some trouble with this at first, but I think the problem was due to positioning. In the end, I added all of the category specific re-write rules after the general rewrite rule. When I placed them first, it didn’t work. Might just be that I’m a regex/htaccess newb, though.
Here’s the full .htaccess file that I’m using, including what WordPress generated for the pretty-urls.
# Redirect Wordpress Feeds to Feedburner RewriteEngine on RewriteCond %{REQUEST_URI} ^/?(feed.*) [NC] RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC] RewriteRule ^feed/?.*$ http://feeds.feedburner.com/thislifeofbrian-sitewide [L,NC,R=302] RewriteRule ^category/nerds-at-work/feed/?.*$ http://feeds.feedburner.com/thislifeofbrian-work [L,NC,R=302] RewriteRule ^category/nerds-at-play/feed/?.*$ http://feeds.feedburner.com/thislifeofbrian-play [L,NC,R=302] RewriteRule ^category/teach-them-well/feed/?.*$ http://feeds.feedburner.com/thislifeofbrian-teach [L,NC,R=302] RewriteRule ^category/life-of-brian/feed/?.*$ http://feeds.feedburner.com/thislifeofbrian [L,NC,R=302] # BEGIN WordPress RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress
Good luck, and hopefully you’re more experienced with htaccess/regex than I am.
Posted in CMS Tricks, Nerds at Work | 11 Comments »
Tags: .htaccess, Feedburner, Wordpress
Find that post enjoyable or informative? Why don't you subscribe to the feed for Nerds at Work. Or, subscribe to the site-wide feed and catch up on all my antics.
9 Comments
2 Trackbacks/Pingbacks
-
Pingback:
This Life of Brian » Blog Archive » Grr… Feedburner.
December 13, 2008 -
Trackback:
Training Company Software
January 11, 2012

Feedburner is really very useful for syndicating feeds from other websites..:”
i always use feedburner to syndicate my blog posts to other subscribers.~”,
feed burner is very useful for blog owners because it is easy to syndicate feeds using feedburner .:”
i always use feedburner for sharing the feeds of my blog, feedburner is really great,’.
i always syndicate feeds on my subcribers and of course feedburner is definitely a great help ~”,
My girlfriend constantly linked me to this webpage however this is exactly the 1st url page I’ve truly checked out up to now. Im extremely fascinated and at this point a admirer.
My buddy often spoke about this site but this is really the first url page I had taken a look at to this point. Im extremely content and right now a regular.
My buddy normally mentioned this blog page unfortunately this is certainly the first page I’ve checked out at this point. Im very content and at this point a admirer.
I enjoy you because of all your valuable effort on this website. My mother take interest in participating in internet research and it’s easy to understand why. I hear all concerning the lively method you offer efficient tips and tricks via this website and therefore increase response from visitors about this issue then our princess is now becoming educated a lot. Take advantage of the rest of the new year. You are always carrying out a really great job.