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>
61 responses to “Redirect WordPress Feeds to Feedburner via htaccess (Redux)”
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.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!
@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.
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!
Hi Richard, a few things that you might want to try:
Those are just a few things off the top of my head..
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.
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
Nice tip. I will use it on my blog. Thanks… :wink:
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
Sorry Jeff,
just a little add. I have the same problem when I tried to subscribe to your
“View Feed XLM”.
Thanks
Paolo
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
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.