WP Super Cache and FeedBurner

We’ve got a lot of customers running WordPress, and we definitely recommend running WP Super Cache to improve performance. It can help dramatically!

But recently we’ve seen a number of our customers getting hammered by a ton of requests from FeedBurner. Usually the request is of this form:

/somepost?utm_source=feedburner&utm_medium=feed&utm_campaign=SomeCampaignString

We’ve also seen FeedBurner going crazy and making thousands of duplicate requests. One of the sites we host has gotten 45,000 simple status requests (HTTP “HEAD” requests) from FeedBurner today, for no good reason that we can see.

Unfortunately, the default rules of WP Super Cache prevent it from caching any request with a query that contains an equal sign. So all of these requests are being unnecessarily run freshly each time, rather than being served from the cache.

There’s an easy fix to this. Open your Web site’s .htaccess file. Look for the section of lines for WP Super Cache, and find the line which tests %{QUERY_STRING}. Insert this new line of text immediately above the existing line:

RewriteCond %{QUERY_STRING} utm_source= [OR]

The new line (ending with [OR]) must come before the existing %{QUERY_STRING} line. After inserting, the two lines should look exactly like this:

RewriteCond %{QUERY_STRING} utm_source= [OR]
RewriteCond %{QUERY_STRING} !.*=.*

There are four very similar blocks right next to each other in the .htaccess file. Be sure to add the new line to the same place in each block.

That’s the only change you’ll have to make! WP Super Cache will now be able to cache requests for normal pages that come from FeedBurner or Twitterfeed. If your Web site was being abused by FeedBurner (or Twitterfeed), you should see a definite improvement.

Update April 2012: Newer versions of the WP Super Cache plugin have four places that need to be changed, rather than two places. We’ve updated the post to reflect this.

Update October 2015: This post was updated to improve the RewriteCond rule so that more requests can be cached.

6 Comments

  1. Luv these wordpress tips you guys have been coming out with, much appreciated!

  2. Hi
    I am facing a strange problem for my blog , If i use the WP Super cache then then fees are not updated at feedburner on timely basis.
    Please have a look at my blog ,http://www.latest-price.com/latest-mobile-phones/
    and feeds , http://feeds.feedburner.com/latest-price/mobile
    As you may see the posts are not updated on the feedburner when the “WP Super cache” is turned on.

    If i turn it off , the site gets slower but feeds works fine, there are lots of expired cached pages , if i delete them , they bog works well with feedburner.
    But again within 1 or 2 days the same problem occurs.

    Thanks for the Help in Advance

  3. Pankaj,

    This is probably a question you should ask in the WordPress support forums (since you aren’t a customer of ours, we can’t look at how your site is working). It sounds like something is wrong if your obsolete cached pages aren’t being removed when you make changes.

  4. If this still needed? I see WP Super Cache now has this option: “Don’t cache pages with GET parameters. (?x=y at the end of a url)”

  5. Adam — you’re right that this tip is no longer necessary as long as that option isn’t checked. New versions of WP Super Cache handle this automatically, and we’ve updated the post to reflect that.

    Thanks for pointing this out!

  6. @pankaj
    yes, you are right. I am also facing the same problem.