Touching base on this topic again after reading another post interested in this feature, here is another version which allows either a MODx id or a url to be passed to the snippet. Also the issue raised by AMDbuilder where an id wouldn't work has been fixed I think

.
I don't have mobile web browser testing capabilities, so if someone would give this a try it would be appreciated.
<?php
/* Mobile_redirect
11/24/09 10:31 am est
original code: http://www.brainhandles.com/techno-thoughts/detecting-mobile-browsers
usage: call in the top of your template
[!Mobile_redirect? &mID=`1`!]
[!Mobile_redirect? &url=`http://redirectdomain.com`!]
link back to main page:
add &views=1 to the link
ex: <a href="http://yourmainsite.com?views=1">Link Back to Main site</a>
*/
// set the MODx document ID of the mobile page
$mid = isset($mID) ? $mID : "1";
// set the url you want to redirect to
// http://domain.com or http://sub.domain.com
$url = isset($url) ? $url : '';
if(isset($_GET['views']) || $_SESSION['views'] =='1'){
$_SESSION['views'] = 1;
}else{
if(isset($_SERVER["HTTP_X_WAP_PROFILE"]) || preg_match("/wap\.|\.wap/i",$_SERVER["HTTP_ACCEPT"])) {
if($mid =="" && $url !=""){
header("Location: ".$url."");
}else{
$goto = $modx->makeUrl($mid);
$modx->sendRedirect($goto);
}
}
if(isset($_SERVER["HTTP_USER_AGENT"])){
if(preg_match("/Creative\ AutoUpdate/i",$_SERVER["HTTP_USER_AGENT"])) { return false; }
$uamatches = array("midp", "j2me", "avantg", "iphone", "docomo", "novarra", "palmos", "palmsource", "240x320", "opwv", "chtml", "pda", "windows\ ce", "mmp\/", "blackberry", "mib\/", "symbian", "wireless", "nokia", "hand", "mobi", "phone", "cdm", "up\.b", "audio", "SIE\-", "SEC\-", "samsung", "HTC", "mot\-", "mitsu", "sagem", "sony", "alcatel", "lg", "erics", "vx", "NEC", "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch", "rover", "pocket", "benq", "java", "pt", "pg", "vox", "amoi", "bird", "compal", "kg", "voda", "sany", "kdd", "dbt", "sendo", "sgh", "gradi", "jb", "\d\d\di", "moto");
foreach($uamatches as $uastring){
if(preg_match("/".$uastring."/i",$_SERVER["HTTP_USER_AGENT"])) //return true;
if($mid =="" && $url !=""){
header("Location: ".$url."");
}else{
$goto = $modx->makeUrl($mid);
$modx->sendRedirect($goto);
}
}
}
}
?>