Chip's Tips for Developers

Contains coding, but not narcotic.

The right way to redirect a WordPress 2.0 feed through FeedBurner

February 6th, 2007 12:07:08 pm pst by Sterling Camden

UPDATE: WordPress 2.2 stuffs this approach. But fear not, there is yet a far, far better way of doing this. Download and activate the FeedBurner FeedSmith plugin – it’s automagic!

For a while now I’ve been redirecting my WordPress feeds through FeedBurner using a content pumping hack. That approach has the advantage of maintaining the standard feed URLs for WordPress, but it does place a little more burden on my server. After changing servers, I discovered another disadvantage: for some reason FeedBurner suddenly stopped distinguishing individual visitors. I’m guessing it’s a change to the way fopen works on a URL between versions of PHP.

Then yesterday, Randy invited me to join the KBCafe FeedBurner network. While doing so, I also decided to join the FeedBurner Ad Network. Somehow, I don’t think feed advertisers would be exactly chomping at the bit to place ads in a feed with only four subscribers, three of them bots. Time to fix this.

The right way

Instead of regurgitating content, you can just return a header to redirect the client. If you haven’t already, rename wp-rss2.php in your root directory to wp-rss2-fb.php. Burn a feed in FeedBurner, using that page as the feed source. Now create a new wp-rss2.php that contains only:

<?php
header( 'Location: http://feeds.feedburner.com/ChipsTips');
?>

Replace “ChipsTips” in the URL with your FeedBurner feed name. This performs a temporary redirect, so your feed’s URL remains the same in all clients, they just always get redirected to FeedBurner. If you want to save yourself some traffic, you can use a permanent redirect instead:

<?php
header( 'Location: http://feeds.feedburner.com/ChipsTips', TRUE, 301);
?>

The 301 response code directs the client to permanently change the URL for this resource, which loses the advantage of keeping the standard WordPress URL. What if you decide to leave FeedBurner? Won’t you lose all your subscribers? Well, it turns out that FeedBurner will return the favor and permanently redirect your feed for 30 days if you unsubscribe. Randy says he’s tested it. So I decided to permanently redirect, hoping to improve throughput for both my feeds and my sites.

Next, make the same change to your ATOM (wp-atom.php), RSS 0.92 (wp-rss.php) and RDF 1.0 (wp-rdf.php) feeds. I decided to redirect all of these to my RSS 2.0 feed in FeedBurner, and then use FeedBurner’s SmartFeed service to convert to other formats as needed. That allows me to aggregate my FeedBurner stats.

And speaking of stats, after FeedBurner had a chance to collect them correctly for a day, I found that even before my move it had failed to disambiguate quite a few subscribers. I have more than twice as many subs as I had thought! Thanks to all of you!

Posted in ATOM, PHP, RSS, Web, Wildly popular, WordPress | 31 Comments » RSS 2.0 | Sphere it!

RSS feed | Trackback URI

31 Comments »

MyAvatars 0.2

[...] UPDATE: There’s a far more excellent way to do this. Tags:Chip’s Tips for Developers: allow_url_fopen feedburner mybrand php phpfb rss wordpress Technorati: allow_url_fopen feedburner mybrand php phpfb rss wordpress [...]

 
MyAvatars 0.2

[...] Update: Not 20 minutes after sending the email to FeedBurner, I got a response saying the problem was resolved.  I’ve checked, and indeed, it has been and my Feedburner feed is now active for my Wordpress blog.  Now I just need to take Sterling Camden’s advice and redirect my default Wordpress feeds to Feedburner. Tags: wordpress, feedburner, rss [...]

 
MyAvatars 0.2
Comment by Randy Charles Morin Subscribed to comments via email

Since both you and I are subscribed to this feed via Rmail, you either just admitted you’re a bot or your called me one.

 
MyAvatars 0.2
Comment by Sterling Camden Subscribed to comments via email

Heh, Randy. No, I meant before I did the redirect, when I was pumping content from FeedBurner opaquely, my site appeared to be the only consumer of the feed to FeedBurner (other than a few bots that found the FeedBurner feed directly). Since RMail uses the site’s feed link (?feed=rss2), our RMail subscriptions were lumped in with all the other subscriptions as one consumer.

But that’s fixed now.

 
MyAvatars 0.2
Comment by Randy Charles Morin Subscribed to comments via email

OK, I get it now. I let you off the hook ;-) Bot!

 
MyAvatars 0.2
Comment by Sterling Camden Subscribed to comments via email

:lol: – R|Mail really is a bot!

 
MyAvatars 0.2
Comment by Randy Charles Morin Subscribed to comments via email

Do you really believe that? Or do you think I’m actually checking feeds by hand against a subscription list and emailing blog entries myself?

 
MyAvatars 0.2
Comment by Sterling Camden Subscribed to comments via email

You’d have to be pretty quick with the mouse/keyboard to fill over a 100,000 subscriptions every day.

 
 
MyAvatars 0.2
Comment by Sterling Camden Subscribed to comments via email

Your Ctrl, C, and V keys must be getting pretty worn out.

 
 
MyAvatars 0.2
Comment by Sterling Camden Subscribed to comments via email

I bet your “Sent Items” folder in Outlook is getting kinda thick.

 
MyAvatars 0.2
Comment by Randy Charles Morin Subscribed to comments via email

What is Outlook? Gmail baby! I have 1200 accounts :-)

 
 
 
MyAvatars 0.2

[...] Vanity. There, I said it. Yes, I like to be the center of attention. How do you know when you’re vain? When finding out that you have 108 subscribers when you thought you had only about 50 gives you such a high that you shouldn’t operate heavy machinery. When you wake up in the middle of the night and turn to your wife and say, “Honey did I tell you that I have 108 subscribers?” And she responds, “for about the 109th time — now go back to sleep!” Carly Simon wrote the song about me, in advance. I wonder if she’s a subscriber? [...]

 
MyAvatars 0.2

[...] They broke my FeedBurner redirect hack. But there is good news! I just saved a bunch of money… no wait, just get the FeedBurner [...]

 
MyAvatars 0.2

i activated the FeedBurner FeedSmith plugin for my wordpress 2.2.1 but this doesn’t seems to work.The default feed link is not redirected.

 
MyAvatars 0.2
Comment by Sterling Camden Subscribed to comments via email

The redirect is temporary, so you won’t see the URL change. But check your FeedBurner stats after a day or so and see if you’re getting hits.

 
MyAvatars 0.2
Comment by Shack Dougall Subscribed to comments via email

I found a hole in the FeedSmith strategy.

I use Bloglines and Firefox to subscribe to feeds, then I read them in GreatNews which is sync’d with Bloglines. In Firefox Options>>Feeds, I have it setup to subscribe to feeds using Bloglines. Firefox autodiscovers the feed and puts the feed icon in my address bar. Then, I click the feed icon in the address bar to subscribe to the feed and Firefox redirects me to Bloglines.

The problem is that after all of this redirection magic, Bloglines sees the feedburner url and uses it. So, even though FeedSmith is using a temporary redirect, it is made permanent because Bloglines saves the feedburner url in my subscription.

I’m still thinking this through, but it would seem that the only way to fix this scenario would be to use MyBrand.

MyAvatars 0.2
Comment by Sterling Camden Subscribed to comments via email

Yes, if you want your URL to show up for the feed instead of FeedBurner’s, then you’d have to use MyBrand or use your own content forwarding like I did over here. I decided it was OK to use FeedBurner’s URL, because they have a redirect policy if you decide to leave, and letting them bear the burden of feed polling helped to ease the load on my server.

MyAvatars 0.2
Comment by Shack Dougall Subscribed to comments via email

Good points. Reducing server load is good.

But it doesn’t seem like MyBrand would place any load on my server. Since it’s using a DNS CNAME, the redirection happens during the DNS lookup. So, even during feed polling, it would never get to my server.

I need to create the CNAME and I need to change my feed links to use the CNAME. But that seems simple enough if I own my own domain. And MyBrand is free now.

I guess the question that’s in my mind is why isn’t everyone using MyBrand? Assuming that you own your domain, are there any reasons not to use it?

MyAvatars 0.2
Comment by Sterling Camden Subscribed to comments via email

Good point, Shack. I didn’t know that the redirect was on DNS lookup. I’ll have to look into this further.

 
 
 
 
MyAvatars 0.2

[...] to a (correctly namespaced) hack to enable conversion from one blogging platform to another and a redirection of WordPress’s feed through FeedBurner before they endorsed the FeedSmith plugin. But I have spent quite a few hours working with the [...]

 
MyAvatars 0.2
Comment by Tony

I have never liked the idea of Feedburner changing the url of my feed such that it shows little information about my website. I guess I have to acceept it that way until I get enough understanding of all the technical stuff you mentioned above about redirecting. Thanks for sharing the tip anyway. Regards.

MyAvatars 0.2
Comment by Sterling Camden Subscribed to comments via email

Hi Tony,

Check out the UPDATE at the end of the post. It’s really simple now with the FeedSmith WordPress plugin that you can download from the FeedBurner site. You can ignore everything else I said.

MyAvatars 0.2

Thanks buddy. I now use the FeedSmith plugin. It does a neat job. And I need not bother about the technicality of redirecting. Cheers ;-)

MyAvatars 0.2
Comment by Sterling Camden

My pleasure. I’ve just moved the UPDATE to the beginning of the post, so others won’t have to read all the way to the end to get to the good stuff.

 
 
 
 
MyAvatars 0.2

[...] as I indicated above. The information on how to do this with WordPress was at the blog posts The right way to redirect a WordPress 2.0 feed through FeedBurner and The FeedSmith Plugin: newly fortified as part of this delicious [...]

 
MyAvatars 0.2

Greatfull to the Lord taht you’ve cleared out my trouble, you know after haveing got acustomed to a “2.0″ version I can’t get used to some changes in wordpress 2.5, think I’m not the only one with such a difficulty.

MyAvatars 0.2
Comment by Sterling Camden

Glad it helped, though it’s a bit outdated now. FeedBurner was acquired by Google, so the FeedSmith plugin comes from them now. You can find it here: http://www.google.com/support/feedburner/bin/answer.py?hl=en&answer=78483

 
 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

Subscribe without commenting

Better Tag Cloud