Quote:
Originally Posted by epitome
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);
}
?>