Redirect your RSS Feed Without Using Plugins or Editing .htaccess

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!:

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.

Wish your site was as fast as this?

Do It With WordPress is proudly hosted by WP Engine, the very best WordPress hosting that money can buy.

Aside from being blazing fast, it's very secure, has a staging area to test changes before making them live, automated daily backups, malware scanning, stellar support from WordPress experts... It's just everything that you would want from your host, and more.