Redirecting Feed to Feedburner with htaccess

by Jason Diehl on November 4, 2009 · 4 comments

in Blogging Tips, Setting Up Wordpress, Wordpress General Tips

Post image for Redirecting Feed to Feedburner with htaccess

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-]+)?/?$ http://feeds.feedburner.com/wordpress-master/feed [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. Are you Brainstorming to “Feed” Content Ideas to your Blog?
  2. Accessing Wordpress functions from external PHP pages
  3. Moving your Wordpress Site? Don’t forget hidden files.
  4. Does CAPTCHA Hurt Your Blog?
About The Author: Hi, I'm Jason Diehl 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 4 years working for a Web Hosting provider helping many website owners one on one with their needs to build their sites. To learn more about this website and me visit About Wordpress Master.

{ 3 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.

Reply

Rafael Rubira January 28, 2010 at 6:32 am

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

Reply

Jason Diehl January 30, 2010 at 4:30 pm

Excellent, Glad to help.

Reply

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

{ 1 trackback }

Tweets that mention Redirecting Wordpress Feed to Feedburner with htaccess -- Topsy.com
November 4, 2009 at 5:54 pm


Previous post:

Next post: