Download this detectmobile.js and make this changes in your head tag
<head>
<script src="detectmobile.js"></script>
<script>
try {
// This is the URL where mobile
detectmobile.defaultMobileURL = "http://m.testing.com";
detectmobile.process();
} catch(e) {
// Make sure that in the fault modes
// we do not interrupt execution of other Javascript code
}
</script>
</head>