WordPress Wednesday: Redirecting WordPress feeds to Feedburner using .htaccess

FeedBurner provides an excellent feed service that lets you track how many users are subscribed to your feed. You also get a shorter name especially if you are working with Category feeds.
Users can still bypass your FeedBurner feed and continue to subscribe to your original blog feed.
While this is not a problem, your stats may not give you slightly inaccurate number of your feed subscribers.
A good option is the WordPress FeedBurner Plugin, which will redirect all your feeds to Feedburner.
If you do not wish to use another plugin or if, like me, you are redirecting a category feed, (I got one for Connections Reloaded), then you can redirect your users by adding the following code to your .htaccess file. Replace AAAAAA by that of your feedburner feed.
# Redirect /feed/ to Feedburner (if not Feedburner bot)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner
RewriteRule ^feed/?([_0-9a-z-]+)?/?$ http://feeds.feedburner.com/AAAAAA [R,L]
</IfModule>
Make sure you add this code before the section of the code added by WordPress. Otherwise your feed won’t be redirected.
The code explained:
The first line of the code is a comment.
The second line checks if mod_rewrite is installed. This is to ensure that your site doesn’t break.
The third line turns the RewriteEngine on. This is required before any rules are used.
The fourth line is extremely important. It ensures that the FeedBurner Bot is excluded from the redirection. If this line is missing your feed fetching will result in an infinite loop.
The fifth line redirects the /feed/ to your feedburner feed.
The last line is just a closing tag for the mod_rewrite check.
Liked this article? Please use the icons below to spread the word or Subscribe to site feed, subscribe via email or add to your Technorati favs to receive regular updates..
Post Details
- Post Date :
- Wednesday, Dec 13th, 2006 at 12:00 pm
- Category :
- Articles and Techtites Daily and Wednesday
- Tags :
- Articles, Blogging, feed, feedburner, htaccess, WordPress
- Do More :
- You can leave a response, or trackback from your own site.




No Responses to “ WordPress Wednesday: Redirecting WordPress feeds to Feedburner using .htaccess ”