.htaccess或使用php,如何重定向网站,如果设备是一个移动设备,标签或任何方便的设备


.htaccess or using php, How to redirect the site if device is a mobile, tab or any handy devices

如果用户使用手机,我想重定向页面

https://example.com

https://example.com/mobile/。

请建议我php.htaccess代码

http://mobiledetect.net/

使用这个你可以很容易地检查它是否是移动的。

include 'Mobile_Detect.php';
$detect = new Mobile_Detect();
// Check for any mobile device.
if ($detect->isMobile())
   header('Location: https://example.com/mobile');
else
   // other content for desktop