How to redirect subscribers of your blog’s RSS feed to a new feed URL
Posted by james | Filed under Uncategorized
So, you’ve moved your feeds location, be it from one directory to another or a whole new domain name or hosted service, and you want people to be able to continue to receive the correct feed?
Recently I was faced with the challenge where I need to make sure that the readers of our company’s blog were being brought to our new Feedburner feed so that we could do some stats tracking, without them having to subscribe to a new feed url. So I did a little research. I needed to know what the limitations were for RSS readers and how they handled redirects, be it through .htaccess or through php.
As it turns out, most RSS readers do follow the standard 301 Permanent redirect. So if you have an RSS but want your readers to subscribe to a new one without having to know the new feed’s URL you can simply add either a 301 redirect for the new feed via .htaccess or if you’re using one of the many popular php blogging formats, you can use php do achieve the same affect. I’ll show you how.
301 Redirect via .htaccess
To achieve a 301 via .htaccess add the following to your .htaccess file:
Redirect 301 /feed.html http://www.youdomain.com/newfeed
where /feed.html is the location of the file you want to redirect from and http://www.yourdomain.com/newfeed/ is the location of the new feed you want to have the reader redirected to.
301 Redirect via PHP using Wordpress
If you’re using Wordpress and want to redirect readers to say a Feedburner url of your feed with changing the feed URL on your Wordpress blog you can add the follow bit of code to the following files:
For the main posts, you can redirect the four feed types: RSS, RSS2, ATOM, RDF.
The files you’ll need to modify are located in /wp-includes and are*:
- feed-atom.php
- feed-rdf.php
- feed-rss2.php
- feed-rss.php
*You only need to modify the feeds in which you’re serving to your readers.
In our case we’re only offering the RSS2 feed.
Open your feed file in your favorite php editor (notepad will work too), and add the follow to the top of the php file just below the opening <?php tag:
header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
header('Status: 301 Moved Permanently');
header('Location: http://www.yourdomain.com/newfeed');
exit();
This will tell automatically have the RSS reader pull the feed from the new feed URL.
That conclude this howto on setting up a 301 redirect for your blog’s RSS feed. Hope it helped.

August 26, 2009 at 9:20 am
[...] did a bit of research and tested my 301 redirect on google reader, and it seems like it feed readers have no problem with [...]