With the recent switch from Typo to WordPress I had to address the issue of handling my existing and new feeds. On top of that I decided that it was the right moment to switch to FeedBurner, so I had to handle the redirect for both Typo and WordPress at the same time. If you prefer Atom 1.0 over RSS 2.0 (you should), this brief post will tell you how to migrate to FeedBurner and Atom.
Where is your Atom feed?
When you join FeedBurner, you may want to create 2 feeds, one for your posts and another one for the comments. When you do so ensure to provide FeedBurner with your Atom 1.0 feeds for both of them. Typo and WordPress use RSS as their default feed format (auto-discovered), so you may wonder where the Atom feeds are located. Use the following:
Typo: https://yourdomain.com/xml/atom/feed.xml and https://yourdomain.com/xml/comments/atoms/comments/feed.xml
WordPress: https://yourdomain.com/wp-atom.php and https://yourdomain.com/comments/feed/atom/
If you already have feeds at FeedBurner, you can always edit them in order to add the Atom URLs. This will provide your readers with an Atom feed served directly from FeedBurner, but you are still left with a problem. Existing subscribers, those who arrive to your blog and find links to the RSS feed, and readers who know the URL of Typo/Wordpress Atom feed, will bypass FeedBurner. One of the main reasons for using FeedBurner in the first place is to access statistics about your readership, so you want all your subscribers to use FeedBurner.
mod_rewrite comes to the rescue and with a few changes to your main .htaccess file, both RSS and Atom feeds will redirect to FeedBurner. If you are using Typo, your users are subscribing to one of the following feeds:
You will then need to insert in your .htaccess located in the public_html directory, the following:
With WordPress the whole process is simplified by using a plugin called FeedBurner FeedSmith. Once you have installed it (by copying it over the wp-content/plugin directory) and activated it from the Plugins page, you will have to fill in the details of your feeds (available at the Options -> FeedBurner page) as shown in the figure below.
This plugin is handy because it does all the dirty work for you, but should you want to handle this from .htaccess, you can do so by just adapting the technique used above for Typo.
Switching from Typo to WordPress
If you are switching from Typo to WordPress and decide to adopt FeedBurner, you can combine the two above so that both existing and new users obtain the right feeds for your articles and comments. It is however unlikely that you want to create a feed at FeedBurner for each category and tag existing in your blog. It is very likely that you are going to adopt a different URL structure in WordPress from Typo’s default, and therefore a few extra redirects are in order. The following example assumes that you went from Typo to WordPress, and that you configured FeedBurner FeedSmith:
# Redirects Typo tags to WordPress Categories
RewriteRule ^articles/tag/(.*)$ /category/$1 [R=301,L]
# Redirects Typo permalinks for articles and pages
RewriteRule ^pages|articles/(.*)$ /$1 [R=301,L]
# Redirects Posts and Articles to FeedBurner
RewriteRule ^xml/atom|rss|rss20/feed.xml$ https://feeds.feedburner.com/YourSite [R=301,L]
RewriteRule ^xml/atom|rss|rss20/comments/feed.xml$ https://feeds.feedburner.com/CommentsYourSite [R=301,L]
# Redirects Typo feeds for tags and categories to WordPress category feeds
RewriteRule ^xml/atom|rss|rss20/category|tag/(.*)/feed.xml$ /category/$1/feed [R=301,L]
As you can see the first two lines of code (excluding comments) take care of redirecting the existing links to articles, pages and tags. The following two lines redirect the old Typo feeds to FeedBurner, and finally the last line redirects the feeds for the tags and categories in Typo to their respective category feed in WordPress.
Get more stuff like this
Subscribe to my mailing list to receive similar updates about programming.
Thank you for subscribing. Please check your email to confirm your subscription.
Something went wrong.
Antonio Cangiano is a Software Developer and AI Evangelist at IBM. He authored Ruby on Rails for Microsoft Developers (Wrox, 2009) and Technical Blogging ( The Pragmatic Bookshelf, 2012, 2019). He is also the Marketing Lead for Cognitive Class, an educational initiative which he helped grow from zero to over 1 Million students. You can follow him on Twitter.