Redirect WordPress Individual Category Feeds to Feedburner via HTAccess
Time for another Feedburner redirect tutorial! In our previous FeedBurner-redirect post, I provide an improved HTAccess method for redirecting your site’s main feed and comment feed to their respective Feedburner URLs. In this tutorial, we are redirecting individual WordPress category feeds to their respective FeedBurner URLs. We will also look at the complete code required to redirect all of the above: the main feed, comments feed, and of course any number of individual category feeds. Let’s jump into it..
Initial Setup
As we are redirecting our category feeds to their associated FeedBurner URLs, you will first want to make sure that these feeds exist and are accessible. Once you have the URLs of the FeedBurner feeds for your categories, make a list of their associated WordPress categories for easy reference. In addition to this information, you will need:
- A WordPress-powered blog (with the required categories)
- An Apache server with the
mod_rewrite
module enabled - Access to to your domain’s root HTAccess file (or to httpd.conf)
For this tutorial, we will assume the following hypothetical WordPress/Feedburner feed URLs:
- Main feed:
http://domain.tld/feed/
==http://feeds.feedburner.com/main-feed
- Comments feed:
http://domain.tld/comments/feed/
==http://feeds.feedburner.com/comments-feed
- “Business” category feed:
http://domain.tld/category/business/feed/
==http://feeds.feedburner.com/business-feed
- “Pleasure” category feed:
http://domain.tld/category/pleasure/feed/
==http://feeds.feedburner.com/pleasure-feed
- “Nonsense” category feed:
http://domain.tld/category/nonsense/feed/
==http://feeds.feedburner.com/nonsense-feed
Redirecting Category Feeds
Here is the generalized HTAccess code that we will be using to redirect our three categories:
# Redirect WordPress Category Feeds to Feedburner
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
RewriteRule ^category/business/feed/?.*$ http://feeds.feedburner.com/business-feed [L,NC,R=302]
RewriteRule ^category/pleasure/feed/?.*$ http://feeds.feedburner.com/pleasure-feed [L,NC,R=302]
RewriteRule ^category/nonsense/feed/?.*$ http://feeds.feedburner.com/nonsense-feed [L,NC,R=302]
</IfModule>
That’s the core of this tutorial, right there. The first line checks for the existence of the required Apache module, mod_rewrite
, while the second line enables the module (you may remove this line if already included in your file). Then, the third line ensures that the two Feedburner user agents are not redirected. The next three lines each match against a specific category feed URL and subsequently redirect the request to the appropriate Feedburner counterpart. Further, we are using the “No-Case” ( [NC]
) modifier to ensure case-insensitive pattern matching for all directives. Finally, each of the three rewrites is executed as a “Temporary” ( [R=302]
) redirect.
Now, to implement this method, edit the last three lines according to your specific category and Feedburner feed information. Double-check that the changes are accurate. For additional categories, duplicate one of the three RewriteRule
s and edit as necessary. For fewer categories, simply delete one or two of the last three lines and edit as necessary.
Once you have edited the code to meet your needs, place the entire chunk of code into your site’s root HTAccess file. If your WordPress installation is located in a subdirectory, you may also place the code in the root HTAccess for that subdirectory. In either case, make sure that this code is placed before the default WordPress permalink rules.
Once uploaded to your server, verify functionality by navigating to your redirected category feeds. If everything is place and edited correctly, the redirects should be working and your category feed URLs should be opening their associated Feedburner feeds.
Redirecting Main, Comments, and Category Feeds
Chances are, if you are redirecting your WordPress category feeds to Feedburner, you will also want to redirect your blog’s main feed and comments feed as well. With our category-redirect code in place, we simply need to add two additional lines of code:
RewriteRule ^feed/?.*$ http://feeds.feedburner.com/main-feed [L,NC,R=302]
RewriteRule ^comments/?.*$ http://feeds.feedburner.com/comments-feed [L,NC,R=302]
Edit these two lines of code with your particular feed information and then place them into the category-redirect code as follows:
# Redirect WordPress Category Feeds to Feedburner
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
RewriteRule ^feed/?.*$ http://feeds.feedburner.com/main-feed [L,NC,R=302]
RewriteRule ^comments/?.*$ http://feeds.feedburner.com/comments-feed [L,NC,R=302]
RewriteRule ^category/business/feed/?.*$ http://feeds.feedburner.com/business-feed [L,NC,R=302]
RewriteRule ^category/pleasure/feed/?.*$ http://feeds.feedburner.com/pleasure-feed [L,NC,R=302]
RewriteRule ^category/nonsense/feed/?.*$ http://feeds.feedburner.com/nonsense-feed [L,NC,R=302]
</IfModule>
With that code in place (and properly edited), your server will redirect all requests for your blog’s main, comments, and specified category feeds to their respectively associated Feedburner feed URLs. All other types of feeds (tags, post comments, author feeds, etc.) will not be affected and will appear as normal when requested.
Props
Thanks to Alexander for his question about redirecting category feeds. His code was used as the catalyst for the elaborated techniques presented in this article.
35 responses to “Redirect WordPress Individual Category Feeds to Feedburner via HTAccess”
Hi Jeff –
Thanks for your post. It worked. I do have q: Bloglines is still showing the feed as empty although feedburner has all of my posts. Would you know how I can fix that? I have to be doing something wrong. I emailed Bloglines but so far 3 biz days and no answer. Argh!
Thanks in advance!
Juana
These all are proved to be a waste of time. You can read my post here: http://www.satya-weblog.com/2010/02/redirect-wordpress-feed-url-feedburner.html.
Better to just use feedsmith plugin and use the technique similar to I have used. and mentioned in the post for which link given.
@Juana: unfortunately, no, I don’t have any ideas for the bloglines stuff. Hopefully they will respond with some help.
@Satya Prakash: thanks for the information. I will check it out and test as soon as I get the time. Remember to put the code before your permalink directives (if you haven’t tried that already).
Thank you so much for this! It cured a huge panic-induced headache! And thanks for specifying that the redirect code has to go BEFORE the default WordPress permalink rules. This is vital, as it doesn’t work when the redirect code is placed after permalink rules.
We have a 3.0 MultiSite setup where people can control their own blog categories, so modifying htaccess in this way doesn’t seem like an option.
Is there another solution to use feedburner for the blogs’ feeds and still get access to category feeds?
It worked fine for me thanks, but i have a problem, how i can get it working if i wanna redirect this url?
http://www.digitalking.it/feed/?lang=en
(i have multilingual blog)
i just correctly redirected main language feed
http://www.digitalking.it/feed
thanks a lot,
Simone
I used code similar to this in my .htaccess file, but my feedburner feed wouldn’t update, so I removed the redirect code. Unfortunately the redirect keeps happening and now I get the following error.
Error getting URL: 400 – Recursive feed redirection error: Are requests for your ‘Original Feed’ address — the feed that FeedBurner is checking for updates — being redirected to your FeedBurner feed? Make sure your Original Feed is provided from a web address that isn’t redirected to FeedBurner.
Where else could the redirect be coming from? This is killing me.
Thanks
I’ve experienced similar issues dealing with FeedBurner. First remove htaccess rules, then remove plugins. If still nothing grep the FeedBurner URL in your site files and search the database.
Along the way, ping FeedBurner between steps to update your feed. Working with a clear browser cache also helps to diagnose.
Good luck!
@Jeff
Found the issue indirectly using grep. Saw that my ads plugin wp-insert had a feed manager, and sure enough once that feature was disabled everything went back to normal! Thanks for the help!
Thanks for manuals.
What about BuddyPress redirect feed ?
like that
http://yourdomain.com/activity/feed/
I use temp redirect activity RSS feed of BuddyPress to feedburner
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
RewriteRule ^activity/feed/?.*$ http://feeds.feedburner.com/yourdomain-activity [L,NC,R=302]
</IfModule>
It is not working.
This helped me!
I had previously been using the feedburner feedsmith plugin, but I needed to be more specific with specific feeds. Your solution did the trick.
I reposted at one of my sites with a credit and link to your site: (404 link removed 2016/09/11)
Thanks for your help!