Redirect your RSS Feed Without Using Plugins or Editing .htaccess

Use FeedBurner without a plugin

It is pretty common for bloggers to want to use FeedBurner to handle their RSS feeds, because of the additional benefits it offers, such as statistics, automatically adding AdSense ads to the feed and pinging services about your new content.

Traditionally, the advice has been to use the FD Feedburner Plugin, which does the trick just fine, don’t get me wrong. But as you should probably know by now, I prefer to handle such items with functions where possible. Because of the prevalence of people using the Feedburner plugin, it wasn’t easy to find too much information on this subject, but after doing some searching, I was able to nail down enough to put together my function which redirects all readers to my FeedBurner feed.

It would be a simpler function if not for the fact that you have to check whether the user-agent is FeedBurner. This is because you have to allow FeedBurner through to your site without being redirected, so that it can actually look at your content, while keeping the redirect in place for everyone else.

At any rate, without any further ado, here is the function, which I drew up with the help of Erik Shultz. Just drop it into your functions.php file and you’ll be set – just be sure to change the FeedBurner URL to that of your own feed!:

2 thoughts on “Redirect your RSS Feed Without Using Plugins or Editing .htaccess”

  1. Josephine says:

    Hi Dave, thanks for this snippet. One question – are all WP feeds redirected to Feedburner? I mean tags, categories, and comments feed along with the main site feed?

    1. Hi Josephine,

      No, this is only for the main feed. You can create extra feeds and send those to FeedBurner as well, but that would be a lot of manual work to create all of those feeds for every category, tag, author etc.

Leave a Reply

7ads6x98y