Mobile redirect on wordpress (question)

I was wondering if anyone can give me an opinion on the best way to redirect a site to another url when a mobile phone opens the page.

Since I’m using wordpress, my first thought was to create a page with a domain [I]http://www.example.com/mobile[/I] and assign a page template to it, and write a small function in the function.php to redirect using $_SERVER[‘HTTP_USER_AGENT’]. I would rather have the domain as something like m.example.com by using sub domains but I don’t think that would work with permalinks, if it can be done with permalinks, please tell me :slight_smile:

Any tips/links for tutorials/suggestions anyone can give me will be greatly appreciated.

Thanks
-Charles