So, you have a WordPress site that you want to easily have syndicated or add extra features to the feed. Maybe you want to add “flairs” to you feed or make your feed easy to read when someone clicks on it with a browser which normally doesn’t understand how to display a feed’s XML without an associated style sheet. Maybe you want feed readers that only understand atom to be able to consume your RSS feed. Maybe you want to have more detailed statistics on how your feed is being used and by whom.
Well, this is where FeedBurner comes into play. To learn a bit more about what FeedBurner does you can check out some of their features here.
How FeedBurner works… You tell FeedBurner the URL of your feed. It then consumes your feed, fixes some things with it, makes it more compatible with feed readers, adds functionality, if you want such as an “email author”, “add a comment”, “Digg this” and other such additions to the feed. FeedBurner can also autodetect the type feed the reader needs and covert your feed from one format, such as RSS to Atom or visa verse. FeedBurner then makes a new feed on it’s site that provides the new feed which then can be consumed by readers and aggregators in place of your site’s native feed.
The issue is then, to have the readers or aggregators use this new feed rather than the one on your site while getting their info for the feed from your site. At the same time, FeedBurner needs access to your original feed (or an additional, hidden feed known only to FeedBurner). FeedBurner would access your feed or the hidden feed, feed readers and aggregators would access the original feed location but using mod_rewrite rules, be redirected with a 302 (temporary redirect) to the new feed provided on FeedBurner’s site. The reason that you want to use a 302, temporary redirect rather than a 301, permanent redirect is that if you stop using FeedBurner or otherwise want the clients to start using the original feed again, you just remove the temporary redirect and they continue using the same URL they always have while clients are supposed to actually update their URLs to point to the redirected one in the case of a permanent redirect.
There are a couple WordPress plugins that help you do this however, they still have you edit your Apache config files or a .htaccess file in addition to installing an managing the plugin.
I’ve found what I think is a much simpler solution.
By adding only a few lines to your Apache configuration or .htaccess file, everything will magically work without a plugin, without an additional feed and without any headaches. It’s simple, quick and works well. The concept is to make a rewrite rule that allows FeedBurner to access your original feed directly but sets up a temporary redirect pointing to FeedBurner’s new feed for all other access to your feed URL.
We do this by first checking the User Agent string. This string contains information on what/who is accessing the URL. If it’s FeedBurner, we allow it, otherwise, we’ll redirect with a 302 to the FeedBurner feed.
This is done with the following rules:
# Make sure that mod_rewrite is turned on
RewriteEngine On
# Rewrite accesses to the /feed for HOSTSs which are not feedburner.com
# This way, feedburner gets our real feed, everyone else gets redirected to feed burner
RewriteCond %{HTTP_USER_AGENT} !^.*FeedBurner.* [NC]
RewriteRule ^/feed.*$ http://feeds.feedburner.com/<your_feed> [R=temp,L]
The above code works with WP 1.5. The only thing you need to change to have it work with WP 2.x is the regular expression for the feed. In my case above, the feed on my site is located at http://blog.mecworks.com/feed and is referenced by the regex ^/feed.*$ in the RewriteRule above.
Once this is done, go to your account on FeedBurner.com and then under the “Optimize” tab, select “Browser Friendly” and put the original feed location in “Redirected Feed URL” field. That will ensure that when people subscribe from the feed page, they’ll be subscribing to your original feed URL, not the FeedBurner one.
I’ve been running with this new setup in my Apache server and FeedBurner feed for three days now with no known issues. Its more simple than having to create an additional feed just for FeedBurner while redirecting all traffic from the old feed. It provides the same functionality as the WordPress plugins but it’s easier to manage in my opinion.
Please let me know if this works for you. This method should work for other blogging software in conjunction with FeedBurner as well. Feedback welcome!
And finally, if you want to subscribe/aggregate to my feed, copy this URL into your feed reader/aggregator: http://blog.mecworks.com/feed rather than the feedburner one so that you will always get my feed regardless of whether or not I continue using FeedBurner.
Comments
Leave a comment Trackback