<?php // ... if ($detect->isMobile()) { header('Location: http://m.example.com' . $_SERVER['REQUEST_URI']); }