<?php  
$userAgent = $_SERVER['HTTP_USER_AGENT'];
$isMobile = strpos($userAgent, 'Mobile') !== false;
if (!$isMobile) {
    header("Location: userRedirect.php");
    exit;
}
?>
https://www.php.net/manual/en/tutorial.useful.php