Redirect your website mobile users to your mobile site in PHP

Are you looking for mobile website redirection script. Take a look at this post I want to explain how to detect mobile user agents like Android, Iphone and Blackberry. Many people are suggested to redirect with .htaccess file but I had implemented this with PHP. It is very easy just few lines of code.
PHP Code:

now what you have to do is make a new php file named user_agent.php

$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");

if ($iphone || $android || $palmpre || $ipod || $berry == true)
echo "<script>window.location=''</script>";

Index.php or Home.php
You have to include like following script.

PHP Code:
include('user_agent.php'); // Redirecting
// data

for symbian os add this line in your existing code :

$SymbianOS = strpos($_SERVER['HTTP_USER_AGENT'],"SymbianOS");

and add this function to if statement as below :

if ($SymbianOS || $iphone || $android || $palmpre || $ipod || $berry == true)