Gabfire Themes BlogStay up to date with the latest news & announcements from Gabfire Themes

How to Redirect WordPress RSS Feed to Feedburner without a Plugin

FeedBurner is a Google owned service that provides RSS traffic analysis and an optional advertising system to online writers. The extra features that FeedBurner offers make it very attractive to WordPress users and many bloggers use the service to power their site feed so that their visitors can subscribe easily.
wordpress-feedburner

How to Redirect WordPress RSS Feed

There are a few plugins and .htaccess methods to redirect the default WordPress feed URL to Feedburner, but if you’re looking  for a way to redirect your feed with a simple WordPress function, copy the code below and paste it into the functions.php file of your theme.

$username = 'gabfire';

function rss_feed_redirect() {
global $feed;
$new_feed = 'http://feeds.feedburner.com/$username';

if (!is_feed()) {
return;
}
if (preg_match('/feedburner/i', $_SERVER['HTTP_USER_AGENT'])){
return;
}

if ($feed != 'comments-rss2') {
if (function_exists('status_header')) status_header( 302 );
header("Location:" . $new_feed);
header("HTTP/1.1 302 Temporary Redirect");
exit();
}
}
add_action('template_redirect', 'rss_feed_redirect');

Make sure to replace gabfire on line #1 with your FeedBurner username and you’ll be all set to redirect your default WordPress feed URL to FeedBurner!

Comments (9)

  1. wp temaları Permalink Reply

    super wp tehemes very goodd

  2. [email protected] Permalink Reply

    Awesome!

  3. سئو Permalink Reply

    very nice.tnx.No harm to seo?

    • Mehmet Ozek Permalink Reply

      You can safely use this function. It will not affect SEO of your site.

  4. بورس Permalink Reply

    Thank you for an excellent and helpful.

  5. خرید عینک آفتابی Permalink Reply

    super wp tehemes very good

  6. mikeyB Permalink Reply

    did it work? Is not working for me, not even using 301 redirect with .htaccess

Leave a Reply

LATEST THEMES