lucy24 - 10:23 pm on Mar 4, 2013 (gmt 0)
Well, ###. I had to leave in the middle of composing a post, and was really hoping that in the intervening hours someone would drift by and answer all your questions.
Yes, you can certainly redirect in both directions. It's basically the identical code either way. Except that the user-agent detector will switch between "is" and "is not", and of course the (sub)domain names will change.
Will users ever have a choice about which version to use? You and the users may disagree on which version offers the better user experience-- and, of course, you will never be able to list all possible User Agents.
Do you plan to re-check the User Agent on each new page load? The alternative requires either cookies or a referer check, with double confusion if someone voluntarily asks for the other version of the site.
How carved-in-stone is the whole thing? Are they fundamentally different sites, or can the differences be reduced to using alternate stylesheets?
I ask this question because last night I serendipitously rediscovered some utterly brilliant code that SOMEONE ELSE posted here last fall. It uses only html and css and is based strictly on viewport size. The only limitation is that it won't work on browsers that don't recognize the "max-width" property. But according to caniuse dot com,* that's MSIE <= 6, so probably expendable.
* Do not repeat not make the mistake I am constantly making w/r/t this domain name. EEEUW.