Redirecting mobile devices to another page best practise
The global task of mobile detection aside, just in regard of the current implementation. 

Every time you see a duplicated code, there is a room for the improvement. 

$mobile = false;
$mob_agents = ["iPhone","Android","webOS","BlackBerry","iPod","iPad"];
foreach ($mob_agents as $marker) {
if (strpos($_SERVER['HTTP_USER_AGENT'], $marker) !== FALSE) {
    $mobile = true;
    break;
}


now you can use a $mobile variable to test whether it's a movile client or not

A more sophisticated version would involve basic regular expressions- something like this:

$pattern = "/iPhone|Android|webOS|BlackBerry|iPod|iPad/";
$mobile = preg_match($pattern, $_SERVER['HTTP_USER_AGENT']);