I ended up using Tera-WURFL. I was planning it but was to lazy to get to know it. It came out it was so easy… You can install it on your host or use it installed on https://wurfl.thesedays.com/
I made very universal version of my configuration, so I can pass it to someone (client’s webmaster) and give him no more than a minute of work to set redirection for me.
I add 1 line to .htaccess file:
DirectoryIndex handleRequest.php index.html index.shtml index.php index.htm default.html Default.htm default.html Default.html default.shtml Default.shtml page1.html index.pl index.cgi index.php3 index.phtml home.htm home.html home.shtml index.wml
Attach my handleRequest.php file:
<?php
// Include TeraWurflRemoteClient.php
require_once ('TeraWurflRemoteClient.php');
// Instantiate a new TeraWurflRemoteClient object
$wurflObj = new TeraWurflRemoteClient('https://wurfl.thesedays.com/webservice.php');
// Define which capabilities you want to test for. Full list: https://wurfl.sourceforge.net/help_doc.php#product_info
$capabilities = array("product_info");
// Define the response format (XML or JSON)
$data_format = TeraWurflRemoteClient::$FORMAT_JSON;
// Call the remote service (the first parameter is the User Agent - leave it as null to let TeraWurflRemoteClient find the user agent from the server global variable)
$wurflObj->getCapabilitiesFromAgent(null, $capabilities, $data_format);
// Use the results to serve the appropriate interface
if ($wurflObj->getDeviceCapability("is_tablet") || !$wurflObj->getDeviceCapability("is_wireless_device") || $_GET["ver"]=="desktop") {
include("index.php"); //default index file
} else {
header('Location: https://m.google.com/'); //where to go
}
?>
And attach required TeraWurflRemoteClient.php file. Just add “?ver=desktop” when linking back to desktop website and you are set ??