Redirecting feeds to FeedBurner

In order to get a better idea of how many subscribers my XML feeds have and what people are using to view them, I have started redirecting feed requests to FeedBurner. Subscribers shouldn’t notice any difference. If you do, please let me know.

The trick I use to redirect feed requests is simple and has been described elsewhere, but since I’m talking about it I might as well share that part as well. It involves messing around in your .htaccess file (if you’re using an Apache server - things may be different on other web servers), so be careful unless you’re comfortable doing that.

The necessary code is as follows:

  1. RewriteEngine on
  2. RewriteCond %{HTTP_USER_AGENT} !FeedBurner
  3. RewriteRule ^feed\.xml$ [R=302,L]

Line 1 enables URL rewriting and may already exist in your .htaccess file. Don’t add it again if it does. Line 2 checks if the user agent requesting the feed is FeedBurner. If it is, the next line is not executed. I want FeedBurner to be able to access the top secret master feed that nobody else should see. Finally line 3 redirects everything else to the feed at FeedBurner. The R=302 flag tells the user agent that the redirect is temporary and that it should keep using the old URL.

For anyone wondering about the /all part at the end of the FeedBurner URL, it is there because FeedBurner won’t let me use just 456bereastreet. It tells me that The uri “456bereastreet” is already taken. Please choose another. Weird.

Update: As pointed out by Justin Perkins in the comments I don’t really need line 2 since I use a non-public feed for FeedBurner. If you do not create a hidden feed you will need it though.

So far it seems to work well except for the “Browser Friendly” feature that displays the XML feed in a readable way when somebody clicks a feed link in a web browser. The feed is displayed alright, but the URL in the location field is changed to the FeedBurner URL. I don’t want that. I want people to subscribe to the original URL: There is a field in the FeedBurner admin UI where you can enter the Redirected Feed URL. I’ve done that, but it doesn’t seem to help. Anyone know what’s up with that?

Sorry if this causes all recent posts to look unread in your feed reader. I use NetNewsWire Lite and had no such problems, so hopefully most feed readers will handle the transition well.

Posted on August 12, 2006 in Site news


  1. August 12, 2006 by Kanashii

    If you have mod_proxy installed you could try using the [P] option instead so the feedburner page displays from your local url.

  2. My RSS aggregator, RSSOwl handled it well. Neat idea by the way. I was looking for something similiar to this a while ago but with no luck which ended up in me writing a “public notice” to my RSS-using readers to change the location of my RSS feed to a feedburner url instead. Not so cool.

  3. Just curious but why did you put a “/all” in there? There doesn’t seem to be any difference without it.

  4. I already changed it at (the HTTP getter doesn’t frankly handle redirects silently) and it works smoothly.

  5. You could still publicize your feed URL to but that would really just 301 redirect to feedburner, then assign feedburner to

    No need to get browser sniffing involved with any of this.

  6. August 12, 2006 by Roger Johansson (Author comment)

    No problems reported yet. Good :-).

    Kanashii: Yeah I read about the proxy thing and may try it out.

    Rosano: Ehh. I don’t really know :-|. I set up the FeedBurner account quite some time ago and if I remember correctly it wouldn’t let me create a feed name without something more after “456bereastreet”. If it works without the “/all” part though… I really have no idea.

    Justin: Hmm. You’re right. I don’t need the sniffing part since I have a non-public feed for FeedBurner to use. Well, that’s what happens when you stay up too late and do things when you’re tired.

  7. Here’s a rewrite rule that accepts or (with optional trailing slash, followed by just about anything) to feedburner…

    RewriteRule ^(atom|rss)/?(.*)$ [R=301,L]

    Then you’d give feedburner something like:

    Allows seamless transition to feedburner.

  8. August 12, 2006 by Roger Johansson (Author comment)

    Justin: That looks like it will work. I wouldn’t use the R=301 flag though since that tells feed readers that the redirect is permanent and that they should use the FeedBurner URL instead. I want them to keep using my URL in case I change my mind about using FeedBurner.

  9. Rojo seems to have no problems what so ever. Great tip by the way :)

  10. August 12, 2006 by Roger Johansson (Author comment)

    I tried getting rid of “/all” in the FeedBurner URL but it won’t let me. It says that ‘The uri “456bereastreet” is already taken. Please choose another.’ I suppose it’s time to contact their support.

  11. You are telling it to redirect but you do not actually wan’t it to redirect? Wouldn’t it be possible to not redirect it then - to let the feed be rabbed from Feedburner without changing the URL on the outside? Just remove the R=302 so it won’t redirect anymore. It may screw up the statictics that Feedburner is giving but it should be the only way prohibiting that the URL isn’t changing - maybe not counting the proxy thing alreadu mentioned.

    I am also curious about what the real benefits of Feedburner are? What statistics does it give that for example awstats don’t give?

  12. August 12, 2006 by Roger Johansson (Author comment)

    Pelle: Yes, that’s pretty much it - I want it to redirect invisibly ;-).

    I don’t want to mess up the FeedBurner statistics since that’s the only reason I’m using it. The difference from AWStats is that FeedBurner tells me the number of subscribers and what they are using. If I could make AWStats do that I’d ditch FeedBurner in an instant. My site statistics are now seriously messed up since all feed requests are being redirected.

  13. Yeah, I think Pelle’s got it right. Just remove the [R=302] from the RewriteRule and it should tell the browser, (feed reader, whatever), that they’re looking at but really the info will be coming from

    I don’t know what the [L] flag does though, you may want to check that too just in case.

  14. August 12, 2006 by Roger Johansson (Author comment)

    John: Nope, same thing still happens. Oh well, no big deal.

    The [L] flag tells Apache to stop parsing the rules and immediately do the redirect.

  15. Roger, you can’t rewrite between different machines/hosts. You will always get the target URI in the address bar.

  16. August 12, 2006 by Roger Johansson (Author comment)

    Jan: Thanks for clearing that up. It’s obvious now that you mention it. Don’t know what I was thinking (I wasn’t) :-P.

  17. Or, precisely, you’d have to use P flag plus mod_proxy, which is not a common setup on shared machines.

    ‘proxy|P’ (force proxy)

    This flag forces the substitution part to be internally sent as a proxy request and immediately (rewrite processing stops here) put through the proxy module. You must make sure that the substitution string is a valid URI (typically starting with http://hostname) which can be handled by the Apache proxy module. If not, you will get an error from the proxy module. Use this flag to achieve a more powerful implementation of the ProxyPass directive, to map remote content into the namespace of the local server.

    Note: mod_proxy must be enabled in order to use this flag.


    ^localpath http://otherhost/otherpath$1

    will become

    http://otherhost/otherpath/pathinfo (via external redirection)

    i.e. the same as

    ^localpath http://otherhost/otherpath$1 [R]

  18. @Jan. If you use a proxy the stats will be messed up since all request will come from the 456bereastreet server.

    PS no problem with Sage rss reader for firefox

  19. So true…

  20. See now, if it hadn’t been for Scrivs picking both of us for the 9@9 yesterday, I probably would have missed this entry because I was so busy trying to figure out the madness of MY feeds! So thanks for this succinct little tutorial, I’m going to give it a whirl and see if my FeedBurner stats start to reflect reality a little more!

  21. Subscribers shouldn’t notice any difference. If you do, please let me know.

    Hmm, if it causes a problem, the subscriber won’t get the feed telling them about this article, and so won’t see the request that they let you know :-)

  22. Firefox live bookmarks failed.

  23. Bloglines showed all entries as new, but continues to work properly.

  24. August 13, 2006 by Roger Johansson (Author comment)

    Lindsay: I hope it helps you sort out your stats!

    Nick: Heh, yeah you have a point there.

    Matt: In what way did Firefox live bookmarks fail? No redirect? Broken feed?

    Kevin: I cleaned up what is included in the feed slightly by removing the links to, Digg, and Newsvine. That could be what caused Bloglines to show all entries as new.

  25. I think that maybe the best solution then would be to do one of two things:

    Build your own statistical tool - which can’t be too hard, but of course isn’t very fun because why reinvent the wheel again? But maybe the best solution.

    The other solution would be to build a sort of proxy on your won - it could emulate everything but the IP-adress and that propably is necessary to get anything out of feedburner.

    A possible third solution would be if XML allowed you to link in the feedburner-xml into your real xml-feed. !ENTITY or somehting would be used then. Should work shouldn’t it?

  26. serendipity has this built in, no need to fiddle with .htaccess files :-)

  27. re: Pelle’s question:

    I am also curious about what the real benefits of Feedburner are?

    There’s lots of benefits that I’ve enjoyed, like:

    1) You give them one feed and they can generate a million different feed types (Atom, RSS, etc…). That way I don’t have to worry about pubslishing multiple feeds and also what feed types work best for my subscribers. They also do that cool thing where they render they feed as HTML if you aren’t a feed reader.

    2) Subscriber stats are huge. Yes you could write your own stats tool but I imagine that wouldn’t be trivial. I don’t like reinventing the wheel if there’s somebody out there who already specializes in the wheel (and offers their service for free).

    3) Your site doesn’t have to bear the brunt of hundreds of feed requests, which suck up bandwidth. I don’t mind letting feedburner handle the heavy lifting on that one.

    I’m sure there are more benefits, but those are the important ones to me.

  28. As a sidenote: if you use WordPress, Steve Smith’s excellent WordPress FeedBurner Plugin does this for you.

  29. Justin: I agree completely with all those benefits.

    I use feedburner for our company blog and it’s so important to me to be able to turn around and say to people we’ve got X subscribers whenever someone asks.

  30. I don’t want to mess up the FeedBurner statistics since that’s the only reason I’m using it. The difference from AWStats is that FeedBurner tells me the number of subscribers and what they are using. If I could make AWStats do that I’d ditch FeedBurner in an instant.

    You might want to have a look at Mint which provides excellent stats. It has a little cousin called Slimstat that is a bit less extensive but free.

  31. August 14, 2006 by Roger Johansson (Author comment)

    WD Milner: Mint is nice looking and all I guess, but since it’s dependent on JavaScript being enabled in the client it won’t tell me the full story, nor will it pick up all feed readers. So Mint is not for me.

  32. Personally, I would build something myself. As others have said, you could use the proxy option - but that wouldn’t solve the statistics part. You could build something fairly simply that would track hits and other data associated with the tracking (timestamp, browser, IP, etc).

  33. Mint is nice looking and all I guess, but since it’s dependent on JavaScript being enabled in the client it won’t tell me the full story, nor will it pick up all feed readers

    My apologies, I wasn’t aware of the strict Javascript requiremetn in Mint. Slimstat is a simple PHP include but may not be extensive enough for your purposes.

  34. Roger, thanks for this article. I’m curious though, are you still using the code you described in your entry even after all the comments?

  35. Oh, I just noticed something and thought I’d share the answer to your original question (which you have probably figured out by now, but it’ll be useful for others who are wondering). The Redirected URL field gets used by FeedBurner to allow users to subscribe to the ‘proper’ URL when they add it to their RSS reader of choice. The “Subscribe with Bloglines” button, for example, passes your specified Redirected URL to bloglines. Without specifying the Redirected URL, it would pass ‘’ to Bloglines.

  36. August 18, 2006 by Roger Johansson (Author comment)

    Jonathan: No, I removed the browser sniffing in line 2 since I don’t need it (I have a private feed for FeedBurner).

  37. Hi Roger, the reason we won’t let you use just /456bereastreet is that someone (unfortunately, not you) has already burned a feed at that URL. I’ll follow up with you in email about this…

    As for redirection, you cannot use Apache mod_rewrite to “silently” redirect to a URL at a different host (that is, redirect but show the original URL). However, some publishers have done neat tricks where they include their FeedBurner feed in a PHP file on their server. This has the effect of redirection, but the URL is a file on your server.

    Watch for an email from me.

  38. August 25, 2006 by Roger Johansson (Author comment)

    John: Thanks for helping me out with that. Feels good to have everything at the right URL :-).

    In case anyone is reading this and is having a problem with my feed, it has been moved from to Please stay subscribed to though - a redirect will make sure you get the right version.

  39. I noticed that replaces my Atom 1.0 feed’s self pointer <link rel="self" href="" type="application/atom+xml" /> by <link rel="self" href="" type="application/atom+xml" /> I wonder if in some cases this could lead to a permanent redirection in the end.

  40. I’m trying to redirect a category feed. I have the main feed being redirected by the Ordered List FeedBurner plugin (2.1) for Wordpress but I want to redirect a specific category feed to a separate FeedBurner Feed.

    The feed is at

    This is what the .htaccess code looks like, but I can’t seem to get it to work…

    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} !FeedBurner
    RewriteRule ^archive/categoryname/feed$ [R=302,L]

    Any ideas what I’m doing wrong? BTW – the last line Rewrite Rule is all one line…

    thanks in advance,

    / Hami

  41. November 21, 2006 by Andreas Bauer

    It’s also possible to redirect with mod_alias:

    RedirectTemp /myfeed.xml

    It can be used when mod_rewrite is not activated.

  42. Dont forget FeedValidator! From: Redirecting Wordpress Feeds to Feedburner

    RewriteCond %{HTTP_USER_AGENT} !.*FeedBurner.*
    RewriteCond %{HTTP_USER_AGENT} !.*FeedValidator.*
    RewriteRule ^feed.*$ [L,R=302]
  43. thanks for the script, although I think you should add ?format=xml at the end

    if a browser/feed reader asks for feed.xml, it is asking for the xml file, but the is actually a html file

    RewriteRule ^atom.xml$ [R=302,L]

  44. Hi, I’ve tried changing all my category feeds this way as well by using the following code.

    RewriteRule ^category/technology/feed.xml$ [R=301,L]

    What am i doing wrong here?? Thx


Comments are disabled for this post (read why), but if you have spotted an error or have additional info that you think should be in this post, feel free to contact me.