View Single Post
Old 06-02-2015, 11:44 PM  
Matyko
PsyHead
 
Matyko's Avatar
 
Industry Role:
Join Date: Aug 2005
Location: Hungary
Posts: 8,632
Quote:
Originally Posted by getcontentnow View Post
Thanks for the code!
Its for redirecting the mobile traffic to the .m version of the same website.
There are better solutions to make this happen. For example we use this on a very simple site, Above <head> !! :

<?php
if(! empty($_SERVER['HTTP_USER_AGENT'])){
$useragent = $_SERVER['HTTP_USER_AGENT'];
if( preg_match('@(iPad|iPod|iPhone|Android|BlackBerry| SymbianOS|SCH-M\d+|Opera Mini|Windows CE|Nokia|SonyEricsson|webOS|PalmOS)@', $useragent) ){
header('Location: ./mobile/');
}
}
?>

This redirects users to domain.com/mobile

But you can also determine a screen width in css to show the mobile site if the width is smaller than xxx pixels... Not sure how this works, but others will help to finetune this method
__________________
-=- Register with our ref link and we help you with the setup! -=-
AdSpyglass.com - Double your profit from brokers
Matyko is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote