Redirecting Wordpress feeds to Feedburner
(Hello. It's been a while since my last post. I mostly post on Twitter, Facebook and identi.ca now. I also maintain two "mini-blogs" on Tumblr and Posterous. My two loyal readers should head over there, follow my social network accounts, or subscribe to my aggregator. *hint, hint* :D Anyway...)
I've been meaning to fold in posts from my two mini-blogs to Coredump, but exclude them in the feeds, since I plan on adding them to my aggregated lifestream. I still haven't found a good solution short of adding a new category (I don't like cluttering my too-many categories {all three of them!}) or mucking around with Wordpress' add_filter in functions.php (which will likely get lost when I update WP). So I ended up focusing on the feed itself.
I've already set up a Feedburner feed long ago, when it was still *just* Feedburner and hadn't been eaten up by the Borg^H^H^H^HGoogle. I can add the feed URL as a link meta in the header, but that's not portable. So, after researching on the web for solutions, I've found a much simpler (and more elegant) one: use .htaccess.
The trick is to get the web server to redirect requests for the Wordpress feed URI to the specified Feedburner URL, like so:
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
RewriteRule ^feed/?.*$ http://feeds.iandexter.net/Coredump [L,NC,R=302]We also want to exclude requests from Feedburner itself, of course, and use HTTP code 302 (temporary redirect) so we can change the target URI later on.
To test:
$ curl -I http://iandexter.net/feed
HTTP/1.1 302 Found
Date: Sun, 29 Nov 2009 16:57:22 GMT
Server: Apache
Location: http://feeds.iandexter.net/Coredump
Vary: Accept-Encoding
Content-Type: text/html; charset=iso-8859-1Try it for yourself, or better yet, subscribe to my feed. :)
I like the way you are making things easier to do. As a real novice in blogging, getting this type of help is wonderful.Thanks for showing us new ways to do things!
ReplyDeleteprinter toner