We all know that Google Feedburner is a great tool for Feeds. Many of you have already opened account in Feedburner and added your feeds. I have seen lots of WordPress site using the link of feedburner but when I manually type in their default feed address. It just shows the WordPress feed. That means you have created the feebburner feed but haven’t use redirection.

There are two ways to redirect the feed to Feedburner:

  1. One is through the WordPress action hook
  2. Second is by editing your .htaccess file

Now let’s look at this two options and learn how to do it:

  1. Redirect WordPress Feeds To FeedBurner using Action Hook: I feel this method as the safe and best way to do feed redirect compared to editing .htaccess file. We have also use the same one, if you try to go to http://catchinternet.com/feed, you will be redirected to FeedBurner’s feeds for Catch Internet. First open your funtion.php file which is located in your theme directory. You can simply add the following snippet in function.php to redirect your WordPress Feed to Feedburner.
    //Redirect WordPress Feeds To FeedBurner
    add_action('template_redirect', 'ci_rss_redirect');
    function ci_rss_redirect() {
    	if ( is_feed() && !preg_match('/feedburner|feedvalidator/i', $_SERVER['HTTP_USER_AGENT'])){
    		header('Location: http://feeds.feedburner.com/catchinternet');
    		header('HTTP/1.1 302 Temporary Redirect');
    	}
    }

    In the above code you just need to replace http://feeds.feedburner.com/catchinternet with the FeedBurner URL.

  2. Redirect WordPress Feeds to Feedburner using .htaccess file: First open your .htaccess file which is located in your root directory (Hint: same folder where wp-config.php is located). You can simply add the following code to redirect your WordPress Feed 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-] )?/?$ http://feeds.feedburner.com/catchinternet [R=302,NC,L]
    </IfModule>

    In the above code you just need to replace http://feeds.feedburner.com/catchinternet with the FeedBurner URL.

Print
  • http://www.wordpressians.com/ WordPress Tricks

    I like your action hook method which is simplest one than the htaccess method. I am using htaccess method in, and you use some plugin to redirect the feeds by, Redirect Feeds | WordPress Tips Blog.

    Best Regards!

  • Shueet

    both methods not working,, first method adds a line in my header and second method made my website gone, 500 error not found contact administrator :(

    • Sakin Shrestha

       Both the method are working method that we already have tested and works perfect. If you could send me email from our contact us form about your side and code then I will be able to help you.

      • http://www.TobyElwin.com/ Toby Elwin

        I found the 500 error as well.  I wish it worked as it is an elegant and easy solution.  I prefer to stay away from hook solutions as I believe they are not as scaleable solution.

  • 420wichita

    How do you seperate the feeds… You have yoursite.com/feed/ and you have yoursite.com/comments/feed/