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:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner
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.

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