Fall Sale! Code FALL2024 takes 25% OFF our Pro Plugins & Books »
Web Dev + WordPress + Security

Redirect WordPress Feeds to Feedburner via htaccess (Redux)

In a previous article, I explain how to redirect your WordPress feeds to Feedburner. Redirecting your WordPress feeds to Feedburner enables you to take advantage of their many freely provided, highly useful tracking and statistical services. Although there are a few important things to consider before optimizing your feeds and switching to Feedburner, many WordPress users redirect their blog’s two main feeds — “main content” and “all comments” — using either a plugin or directly via htaccess. Here is the htaccess code as previously provided here at Perishable Press:

# temp redirect wordpress content feeds to feedburner
<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]
 RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
 RewriteRule ^feed/?([_0-9a-z-]+)?/?$ https://feeds.feedburner.com/yourfeedname [R=302,NC,L]
</IfModule>

# temp redirect wordpress comment feeds to feedburner
<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]
 RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
 RewriteRule ^comments/feed/?([_0-9a-z-]+)?/?$ https://feeds.feedburner.com/yourfeednamecomments [R=302,NC,L]
</IfModule>

The first code block redirects main content feeds to Feedburner, while the second block does the same for the main comments feed. The only editing required for either of these redirects is for the Feedburner URL itself; that is, edit the “https://feeds.feedburner.com/yourfeedname” and/or “https://feeds.feedburner.com/yourfeednamecomments” to match your own address. With this htaccess code in place, your feeds will be redirected to Feedburner for everyone except FeedValidator (or whichever feed-validation service you are using, edit code to match its user agent) and of course Feedburner itself. To add additional exceptions to the redirect, simply replicate either line containing RewriteCond, and edit the user agent (e.g., FeedBurner) to suit your needs. Of course, if you plan on using both of these redirects (i.e., all content and comment feeds), continue reading for a better technique..

New and Improved Method for Redirecting WordPress Feeds to Feedburner

For those of us using Feedburner for all content and comment feeds, we have consolidated the previous htaccess code into a single redirect. Additionally, we improve functionality by verifying the requested URI and simplifying the regex used to match the target string. Check it out:

# temp redirect all wordpress feeds to feedburner
<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_URI}      ^/?(feed.*|comments.*)        [NC]
 RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC] 
 RewriteRule ^feed/?.*$          https://feeds.feedburner.com/yourfeedname         [L,NC,R=302]
 RewriteRule ^comments/?.*$      https://feeds.feedburner.com/yourfeednamecomments [L,NC,R=302]
</IfModule>

If you are redirecting both content and comment feeds, this “new and improved” htaccess code will do the job nicely. With optimized code and improved functionality, it is definitely recommended over the previous directives. Simply edit the URLs in the last two lines to match your own Feedburner addresses (one for posts and the other for comments), and place the code into your blog’s root htaccess file. No other changes should be required. Once the code is in place, test that everything is working by accessing your feed directly using its default (i.e., non-redirected) URL. After that, you can sit back, relax, and enjoy all the benefits of WordPress, Feedburner, and one less plugin to worry about.

Update

If either of your feeds will not redirect using the “new and improved” redirect code, try commenting out the following line:

RewriteCond %{REQUEST_URI} ^/?(feed.*|comments.*) [NC]

..and that should do the trick. Or, another option is to use the two “original” redirects provided in the beginning of this article.</update>

About the Author
Jeff Starr = Web Developer. Security Specialist. WordPress Buff.
The Tao of WordPress: Master the art of WordPress.

61 responses to “Redirect WordPress Feeds to Feedburner via htaccess (Redux)”

  1. Hi Gregory, interesting indeed – that may explain why, on certain server configurations, that initial RewriteCond needs to be omitted, as mentioned in the “Update” at the end of the article. I will have to look into it further before I can say for sure what’s happening, but your information is certainly an eye-opener. Thanks.

  2. Benjamin Thomas 2009/12/11 2:47 am

    Hi Jeff,

    Thank you, that’s exactly what I am looking for, since none of the feed re-direct WP plugins seem to work anymore with WP 2.8.

    Unfortunatly your script does not work for me, I tried all the different version of this script and nothing is redirected i.e.

    RewriteEngine on
    RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
    RewriteRule ^feed/?.*$ http://feeds.feedburner.com/bentographics [L,NC,R=302]

    It’s a feature I’d love to add to my site. Any ideas how to make this work?

    Is there some kind of special server configuration needed? I can set rewrite rules for WordPress, that works fine though.

    Thanks for any pointers!

  3. @Benjamin Thomas: not sure what the issue might be, but one thing that you may want to check is that the rules are placed before the WordPress rules. Also, the various redirect plugins should be working with the latest version of WordPress, so if they aren’t working in your situation, there may be some underlying issue that needs investigating.

  4. Hi – I redirected my rss feed to feedburner a while ago and for the life of me I cannot figure out how to stop it from redirecting. I deactivated and then deleted the feedburner plugin, but it still redirects, so I’m figuring I must have changed some code somewhere.

    My .htaccess file has the standard configuration for permalinks:

    RewriteEngine On
    RewriteBase /blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]

    Nothing about feedburner in here, so I’m not sure why its still redirecting. Any ideas would be immensely appreciated.

    Thanks!

  5. Jeff Starr 2009/12/20 9:20 am

    Hi Richard, a few things that you might want to try:

    • Check the htaccess files for your root directory and your subdirectory
    • Check for any plugins that may be redirecting your feed
    • Implement another redirect to see if your htaccess is working properly

    Those are just a few things off the top of my head..

  6. Thanks for the .htaccess code! I tried using the “new and improved” method, however, the redirects work for users but not Feedburner.

    My main feed works perfectly. But for the comments feed, Feedburner is getting redirected also, so it does not syndicate new comments.

    Currently, I’m using the original method but I would like to try the new and improved method.

  7. Hey Jeff, any tips on redirecting feeds to feedburner in prep of a site launch? I’m wondering about having the site blocked to the public, but allowing the feedburner redirects to go through for testing.

    Would this just be a matter of combining these with some conditional statements to allow the site feeds by a basic .htaccess redirect

  8. Lucas Dillmann 2010/01/29 3:51 pm

    Nice tip. I will use it on my blog. Thanks… :wink:

  9. Hi Jef,

    Before reading this post I was getting crazy to try to redirect my main content feed to feedburner with the different plugin. Nothing worked (I use Worpress 9.2.1).

    Now I can redirect to feeburner but if I choose (from feeburner) the standard ‘View Feed Xml” I cannot see the usual XLM page but I am redirect again to the feeburner page (and I cannot see any more the ling “View Feed Xml”.

    Have you an advise to have this basic function in place?

    Thanks
    Paolo

  10. Sorry Jeff,

    just a little add. I have the same problem when I tried to subscribe to your
    “View Feed XLM”.

    Thanks
    Paolo

  11. Me again Jeff,
    I discovered that the problem is with Internet Explorer 8.
    In the Feeburner Help Group the problem has already been logged but until now (since may of last year) nobody has found a solution.

    Ciao
    Paolo

  12. Jeff Starr 2010/02/14 2:15 pm

    Hi paolo, I wouldn’t worry too much about it. Just try emphasizing a working URL for your feeds and you should be fine. I doubt that too many people ever click on the XML button when viewing your Feedburner feed.

Comments are closed for this post. Something to add? Let me know.
Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
USP Pro: Unlimited front-end forms for user-submitted posts and more.
Thoughts
I disabled AI in Google search results. It was making me lazy.
Went out walking today and soaked up some sunshine. It felt good.
I have an original box/packaging for 2010 iMac if anyone wants it free let me know.
Always ask AI to cite its sources. Also: “The Web” is not a valid answer.
All free plugins updated and ready for WP 6.6 dropping next week. Pro plugin updates in the works also complete :)
99% of video thumbnail/previews are pure cringe. Goofy faces = Clickbait.
RIP ICQ
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.