php - How do you set a custom environment variable (htaccess) based on device? -


how perform simple mobile browser check , store resulting boolean in environment variable in .htaccess php can simple define('ismobile',(env check ? true : false)); statement in common include file?

i have seen scripts redirecting mobile , setting cookies, not found (yet) right detection , setting flow one.

thanks

perhaps post can used base wish do?

http://www.eldeto.com/another-apache-config-file-mobile-device-detection

this separates devices in "high-end" , "low-end", need expand ifs in there set more values mh , ml

edit: here's example, based on page has:

rewriterule .* - [e=ismobile:false] rewritecond %{http_user_agent} ^.*(iphone|android|nokia|blackberry).*$ [nc] rewriterule .* - [e=ismobile:true] 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -