Forum Moderators: phranque
$mobileArr = [
'iphone',
'ipod',
'android',
'mobile',
'sony',
'symbian',
'nokia',
'samsung',
'windowsce',
'epoc',
'operamini',
'nitro',
'j2me',
'midp-',
'cldc-',
'netfront',
'mot',
'up.browser',
'up.link',
'audiovox',
'blackberry',
'ericsson,',
'panasonic',
'philips',
'sanyo',
'sharp',
'sie-',
'portalmmm',
'blazer',
'avantgo',
'danger',
'palm',
'series60',
'palmsource',
'pocketpc',
'smartphone',
'rover',
'ipaq',
'au-mic,',
'alcatel',
'ericy',
'up.link',
'vodafone/',
'wap1.',
'wap2.'
];
(isset($_SERVER['HTTP_ACCEPT']) && strpos(strtolower($_SERVER['HTTP_ACCEPT']), 'application/vnd.wap.xhtml+xml') !== false)
(isset($_SERVER['HTTP_X_OPERAMINI_PHONE']) && $_SERVER['HTTP_X_OPERAMINI_PHONE'] !== '') $ua = $_SERVER['HTTP_USER_AGENT'];
if (
strpos($ua, 'Mobile Safari/537.36 OPR') !== false ||
strpos($ua, 'Opera Mini') !== false ||
preg_match('/OPiOS\/[0-9.]+ Mobile/\w+ Safari/', $ua)
) {
// do Opera Mini stuff
} RewriteCond %{HTTP_USER_AGENT} Mobile Safari/[0-9.]+ OPR [OR]
RewriteCond %{HTTP_USER_AGENT} Opera Mini [OR]
RewriteCond %{HTTP_USER_AGENT} OPiOS/[0-9.]+ Mobile/\w+ Safari
RewriteRule ^ - [E=opera_mini:true]
[0-9.]+Since there is no capture and no closing anchor, all you need in this location is
"Opera/9.80 (MAUI Runtime; Opera Mini/4.4.33576/179.156; U; en) Presto/2.12.423 Version/12.16"with no indication of OS, such as Android or iPthingy. And there are a surprising lot of them, to all appearances human.
As always, the choice between [0-9] and \d is purely a matter of personal coding style.
I re-checked “Opera Mini” in logs. I get a lot of this kind of thing (picking one at random):