Kind of an interesting question...
Anyway, you can't. Google doesn't pass the keyword variable if the person is logged into their Google account (gmail, youtube, etc.). So you would only be able to get the keyword data from people who were not logged into Google or people who were using other search engines.
If you did want to redirect the 30-60% of people not logged into Google, I would use a PHP script that's called before the page loads. I'm sure there's a way to do it with .htaccess, but I only know the basics and I'm more advanced with PHP.