Post image for Redirecting Feed to Feedburner with htaccess

Redirecting Feed to Feedburner with htaccess

by Ed Gately on November 4, 2009 · 5 comments

in Blogging Tips,Setting Up Wordpress,Wordpress General Tips

So here’s a fun story about some wasted time.  I configured feedburner a while back to use as the RSS Feed for the site.

I like the way Feedburner looks compared to the default RSS Feed.  The social icons are better, you can get better statistics out of the system.  Plus, it’s owned by Google.  Never hurts to supply Google with as many links to your site as possible (don’t quote me on that, I really doubt it actually matters).

A lot of times, I like to be a log junkie.  I sit back and hunt through my site logs on occasion.  I like to look for errors with the site, and fix them before they cause to many issues. Sometimes I even find malicious bots trolling the site and I can block them or deal with them at least.

Anyway, I noticed that there were several attempts to hit the WordPress RSS feed that is the default.  The systems ( a Google Gadget, something from Yahoo, etc. ) were hitting the site on a regular basis.  It’s not that they were getting old information, but it was quite a few subscribers that weren’t getting the legitimate feed, and thus I wouldn’t see the proper tracking.

I started scouring the Google Search for a method to redirect the feed via a redirect in the htaccess file.  I didn’t want to use a plugin and create additional overhead when it can be done so easily with the htaccess.  And I didn’t want to spend the time to write it myself, when I’m sure it was out there several times over.

I found a code block from Perishable Press:
# temp redirect wordpress content feeds to feedburner
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner [NC]
RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
RewriteRule ^feed/?([_0-9a-z-]+)?/?$ [R=302,NC,L]

Naturally if you are going to use this code make sure you change out my feedburner address for your own.

The problem was that after I added it to my htaccess it didn’t work.  I just popped it in really quickly, wasn’t paying attention at all.

After spending a lot more time than I wanted to spend on it, researching alternatives online.  I finally started reading comments.  There are several posts out there that all use this code, but none solved my problem.

Reading the comments, someone mentioned that the code has to be before the permalink rewrites that WordPress uses.  Doh, I’m an idiot.  If I would have just spent two seconds to actually look at the code I would have realized it.  But instead I tried to save time and just do it quickly.

I guess in this case trying to NOT “reinvent the wheel” I cost myself a lot of unnecessary time.  Especially on something this simple that I could have just written myself.  Oh well, live and learn.

Related posts:

  1. htaccess Rules for WordPress Permalinks
  2. Are you Brainstorming to “Feed” Content Ideas to your Blog?
  3. Copying Content from Word into WordPress
  4. Do you get stumped writing new blog content?
About The Author: Hi, I'm Ed Gately and I write Wordpress Master to help bloggers get started in building a successful online blog using Wordpress. Prior to writing on this blog I spent over 16 years working in Corporate IT and have been spreading my wings on the web for 3 years. To learn more about this website and me visit About Wordpress Master.

{ 4 comments… read them below or add one }

Floost November 4, 2009 at 10:51 am

Hmm… I read blogs on a similar topic, but i never visited your blog. I added it to favorites and i’ll be your constant reader.


Rafael Rubira January 28, 2010 at 6:32 am

I was having the same problem and you save me! :) ) Thanks


Jason Diehl January 30, 2010 at 4:30 pm

Excellent, Glad to help.


Lorine Catino January 14, 2011 at 12:19 pm

good stuff. Do you have a RSS feed? And will it be cool if I put in your feed to a website of mine? I have a website which draws content through RSS feeds by a number of sites and I would like to include yours, many people really don’t mind given that I link back and everything but I like to get approval 1st. Anyway let me know if you can, thank you.


Leave a Comment

{ 1 trackback }

Previous post:

Next post: