Lighttpd: redirect feed traffic to a Feedburner account

by nixcraft on August 5, 2006 · 0 comments

Lighttpd logo

Reader chadrick asks, "How to redirect feed traffic to a Feedburner account?"

There is a plugin available for Apache and WordPress, but it will not work with Lighttpd. So if you want to redirect RSS/atom feed from your domain to Feedburner to get accurate feed stats, you need to use Lighttpd's mod_redirect module.

For example request coming for following urls shoud go to your feedburner a/c:
http://domain.com/feed/ => http://feeds.feedburner.com/MyAccount
http://domain.com/index.php?feed=rss => http://feeds.feedburner.com/MyAccount
http://domain.com/?feed=rss => http://feeds.feedburner.com/MyAccount

Open your lighttpd configuration file and tell lighty to redirect all visitors except Feedburner bot or site.

# vi /etc/lighttpd/lighttpd.conf

Find out your virtual domain configuration and append following directives:

$HTTP["useragent"] !~ "FeedBurner" {
url.redirect = (
"^/feed*" => "http://feeds.feedburner.com/MyAccount",
"^/\?feed=*" => "http://feeds.feedburner.com/MyAccount"
)
}

Replace MyAccount (or feedburner url) with your actual feedburner feed url. Save and close the file. Restart the lighttpd webserver:

# /etc/init.d/lighttpd restart

If you are using a Blogger.com hosted blog (your own domain) put something as follows (e.g. http://mydomain.com/blog/atom.xml):

$HTTP["useragent"] !~ "FeedBurner" {
url.redirect = (
"/blog/atom.xml" => "http://feeds.feedburner.com/MyAccount",
"/blog/rss.xml" => "http://feeds.feedburner.com/MyAccount"
)
}

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

We're here to help you make the most of sysadmin work. So, subscribe!

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 11 + 13 ?
Please leave these two fields as-is:
Are you a human being? Solve the simple math so we know that you are a human and not a bot.



Previous post:

Next post: