View Single Post
Old 06-03-2010, 08:44 PM  
kristin
GOO!
 
Industry Role:
Join Date: Sep 2002
Location: Back Home : )
Posts: 9,768
Quote:
Originally Posted by epitome View Post
Since she can't, I will.

Code:
<!--JAVASCRIPT MOBILE SITE REDIRECTION CODE-->
<script type="text/javascript">
MOBILE_URL = "http://redirecturlhere.com";

// Do not edit below
var WORDS = ["mobile", "htc", "blackberry", "j2me", "webos", "windows ce", "android", "nokia", "samsung", "LG", "palm", "PSP"];
var WLEN = WORDS.length;
for (var i = 0; i < WLEN; i++)
{
	var re = new RegExp(WORDS[i], "i");
	if (re.exec(navigator.userAgent))
	{	
		window.location = MOBILE_URL;
		break;
	}
}
</script>
Put that in your header...
Thank you, thank you.

htaccess:

#HTACCESS MOBILE SITE REDIRECTION CODE
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (mobile|blackberry|webos|android|j2me|palm|nokia|s amsung|symbian|windows.ce) [NC]
RewriteRule ^(.*)$ http://www.allgirlmobile.com/?revid=25336 [R=302,L]

PHP:

<?php
$REGULAR_URL = ''; // http://www.evilgeniuscash.com/YOURHOMEPAGE.HTML
$MOBILE_URL = 'http://www.allgirlmobile.com/?revid=25336';

// Do not edit below
$WORDS = array('mobile', 'htc', 'blackberry', 'j2me', 'webos', 'windows ce', 'android', 'nokia', 'samsung', 'LG', 'palm', 'PSP');
$is_mobile = FALSE;
foreach ($WORDS as $w)
{
if (isset($_SERVER['HTTP_USER_AGENT'])
&& strpos(strtolower($_SERVER['HTTP_USER_AGENT']), $w) !== false)
{
$is_mobile = TRUE;
break;
}
}
$url = ($is_mobile) ? $MOBILE_URL : $REGULAR_URL;
if (!empty($url))
{
header('Location: ' . $url);
}
?>
__________________
Vacares rules.

"Usually only fat guys have the kind of knowledge and ability that Kristin has."
kristin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote