Quote:
	
	
		| 
					Originally Posted by getcontentnow  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 
