I created a mobile version of my website. I have a subdomain called mobile.thinkdolphin.com. I've tried doing a redirect in my .htaccess file but I get an error saying there are too many redirects:

Code:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^.*iPhone.*$
RewriteRule ^(.*)$ http://mobile.thinkdolphin.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*BlackBerry.*$
RewriteRule ^(.*)$ http://mobile.thinkdolphin.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*Palm.*$
RewriteRule ^(.*)$ http://mobile.thinkdolphin.com [R=301]
I've also tried creating a file called ismobile.php with this code:

Code:
<?php
function ismobile(){
&#160; // check if the user agent value claims to be windows but not windows mobile
&#160; if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce')){
&#160; &#160; return false;
&#160; }
&#160; // check if the user agent gives away any tell tale signs it's a mobile browser
&#160; if(eregi('up.browser|up.link|windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp|N70|S60|S40|S80|S90',$_SERVER['HTTP_USER_AGENT'])){
&#160; &#160; return true;
&#160; }
&#160; // check the http accept header to see if wap.wml or wap.xhtml support is claimed
&#160; if(stristr($_SERVER['HTTP_ACCEPT'],'text/vnd.wap.wml')||stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml')){
&#160; &#160; return true;
&#160; }
&#160; // check if there are any tell tales signs it's a mobile device from the _server headers
&#160; if(isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])||isset($_SERVER['X-OperaMini-Features'])||isset($_SERVER['UA-pixels'])){
&#160; &#160; return true;
&#160; }
&#160; // build an array with the first four characters from the most common mobile user agents
&#160; $a = array(
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'acs-'=>'acs-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'alav'=>'alav',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'alca'=>'alca',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'amoi'=>'amoi',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'audi'=>'audi',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'aste'=>'aste',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'avan'=>'avan',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'benq'=>'benq',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'bird'=>'bird',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'blac'=>'blac',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'blaz'=>'blaz',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'brew'=>'brew',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'cell'=>'cell',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'cldc'=>'cldc',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'cmd-'=>'cmd-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'dang'=>'dang',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'doco'=>'doco',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'eric'=>'eric',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'hipt'=>'hipt',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'inno'=>'inno',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'ipaq'=>'ipaq',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'java'=>'java',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'jigs'=>'jigs',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'kddi'=>'kddi',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'keji'=>'keji',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'leno'=>'leno',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'lg-c'=>'lg-c',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'lg-d'=>'lg-d',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'lg-g'=>'lg-g',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'lge-'=>'lge-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'maui'=>'maui',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'maxo'=>'maxo',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'midp'=>'midp',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'mits'=>'mits',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'mmef'=>'mmef',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'mobi'=>'mobi',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'mot-'=>'mot-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'moto'=>'moto',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'mwbp'=>'mwbp',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'nec-'=>'nec-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'newt'=>'newt',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'noki'=>'noki',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'opwv'=>'opwv',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'palm'=>'palm',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'pana'=>'pana',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'pant'=>'pant',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'pdxg'=>'pdxg',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'phil'=>'phil',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'play'=>'play',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'pluc'=>'pluc',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'port'=>'port',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'prox'=>'prox',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'qtek'=>'qtek',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'qwap'=>'qwap',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sage'=>'sage',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sams'=>'sams',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sany'=>'sany',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sch-'=>'sch-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sec-'=>'sec-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'send'=>'send',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'seri'=>'seri',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sgh-'=>'sgh-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'shar'=>'shar',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sie-'=>'sie-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'siem'=>'siem',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'smal'=>'smal',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'smar'=>'smar',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sony'=>'sony',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'sph-'=>'sph-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'symb'=>'symb',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 't-mo'=>'t-mo',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'teli'=>'teli',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'tim-'=>'tim-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'tosh'=>'tosh',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'treo'=>'treo',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'tsm-'=>'tsm-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'upg1'=>'upg1',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'upsi'=>'upsi',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'vk-v'=>'vk-v',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'voda'=>'voda',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'wap-'=>'wap-',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'wapa'=>'wapa',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'wapi'=>'wapi',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'wapp'=>'wapp',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'wapr'=>'wapr',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'webc'=>'webc',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'winw'=>'winw',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'winw'=>'winw',
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 'xda-'=>'xda-'
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; );
&#160; // check if the first four characters of the current user agent are set as a key in the array
&#160; if(isset($a[substr($_SERVER['HTTP_USER_AGENT'],0,4)])){
&#160; &#160; return true;
&#160; }
}
?>
...with this in the header of my index.php homepage file:

Code:
<?php
require_once "ismobile.php";
if (ismobile() == true) {
 header("location: http://mobile.thinkdolphin.com/")
 exit;
}
?>
When I test that on my iphone the homepage is completely blank.

Can anyone help? Thanks!