So… I needed to redirect my main feed, my comments feed, and two category feeds each to different feedburner feeds. (I am talking about a self-hosted WordPress site.) There is a plugin that automatically directs your main and comments feeds, but that didn’t meet my needs. (You can find that plugin here: http://wordpress.org/extend/plugins/feedburner-setting/)

If like me you need to redirect your feeds but you don’t want to use that plugin what do you do?

I found a solution here: http://perishablepress.com/press/2008/12/15/redirect-wordpress-category-feeds-to-feedburner-via-htaccess/

Basically this tip has you edit your .htaccess file. This one might be for intermediate to advanced users. Perhaps newbies should stick to the plugin. But I decided to try it. :-)

Here is the code that was already a part of my wordpress site .htaccess file:


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

I added this code to the code above:


RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
RewriteRule ^feed/?.*$ http://feeds.feedburner.com/yourfeedburnerinfoformainfeed [L,NC,R=302]
RewriteRule ^comments/?.*$ http://feeds.feedburner.com/yourfeedburnerinfoforcomments [L,NC,R=302]
RewriteRule ^category/oneofyourcategories/feed/?.*$ http://feeds.feedburner.com/yourfeedburnerinfoforacategory [L,NC,R=302]
RewriteRule ^category/anotheroneofyourcategories/feed/?.*$ http://feeds.feedburner.com/yourfeedburnerinfoforanothercategory [L,NC,R=302]

When I was done this is what I had (obviously you need to personalize the various links for your site!):


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
RewriteRule ^feed/?.*$ http://feeds.feedburner.com/yourfeedburnerinfoformainfeed [L,NC,R=302]
RewriteRule ^comments/?.*$ http://feeds.feedburner.com/yourfeedburnerinfoforcomments [L,NC,R=302]
RewriteRule ^category/oneofyourcategories/feed/?.*$ http://feeds.feedburner.com/yourfeedburnerinfoforacategory [L,NC,R=302]
RewriteRule ^category/anotheroneofyourcategories/feed/?.*$ http://feeds.feedburner.com/yourfeedburnerinfoforanothercategory [L,NC,R=302]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

It is important to notice that I added the new code BEFORE the rewrite commands that were already in the .htaccess file. I had tried it AFTER and it didn’t work. It worked fine when I added it BEFORE.

If you cannot figure it out from my instructions visit the post where I found them here: http://perishablepress.com/press/2008/12/15/redirect-wordpress-category-feeds-to-feedburner-via-htaccess/

**IMPORTANT NOTE** You should backup your .htaccess file BEFORE you start messing with it. That way if you end up screwing it up you can at least replace it with the original.

If this works for you comment below. If you have problems leave your questions in the comments below as well.

Hopefully that will help you out!

Tags: , , , ,

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>