i want to setup in my .htaccess apache file the env var for mobile
i have:
SetEnvIf User-Agent "iPhone" devicetype
SetEnvIf User-Agent "Android" devicetype
RewriteRule ^ - [E=DEVICE:%{devicetype}]
but my $_SERVER['DEVICE'] is always empty. why?
Source: Tips4all
You rule will set the $_SERVER['devicetype']
ReplyDelete[devicetype] => 1
you don't need: RewriteRule ^ - [E=DEVICE:%{devicetype}]
If you prefer, you can use this:
RewriteCond %{HTTP_USER_AGENT} "iphone|android" [NC] # i put 2 as example
RewriteRule ^ - [E=DEVICE:mobile]
This will set $_SERVER['DEVICE'] to mobile