OK, This is what I ended up doing and it seems to be working well.
In my htaccess,
Code:
DirectoryIndex index.php index.shtml index.html index.htm
This way index.php is looked for first.
Then in the index.php file I put this,
Code:
$REGULAR_URL = 'http://cleos-porn-links.com/index.shtml';
$MOBILE_URL = 'http://mobile.cleos-porn-links.com/';
// Do not edit below
$WORDS = array('mobile', 'blackberry', 'j2me', 'webos', 'windows ce', 'android', 'nokia', 'samsung', 'LG', 'palm', 'PSP');
$is_mobile = FALSE;
foreach ($WORDS as $w)
{
if (isset($_SERVER['HTTP_USER_AGENT'])
&& stripos($_SERVER['HTTP_USER_AGENT'], $w))
{
$is_mobile = TRUE;
break;
}
}
$url = ($is_mobile) ? $MOBILE_URL : $REGULAR_URL;
if (!empty($url))
{
header('Location: ' . $url);
}
?>
(The links on my mobile domain are getting changed to http://cleos-porn-links.com/index.shtm sometime in the next day or so. Until then the "View Full Web Version" link does not go to my non mobile site)
This way mobile surfers can still reach my regular site but will get presented with a mobile option first. Non mobile surfers will not notice anything different at all and both mobile and non mobile users can still reach any non mobile page too.
On a side note... I modified the htaccess in my porntube by adding this,
Code:
RewriteCond %{HTTP_USER_AGENT} (mobile|blackberry|j2me|symbian|windows.ce) [NC]
RewriteRule ^(.*)$ http://mobile.cleos-porn-links.com/ [R=302,L]
Now the mobile traffic is going to my Topbucks white label site instead of Brazzers. :D
|