GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   >> Best mobile redirect script? (https://gfy.com/showthread.php?t=1031874)

Roald 07-27-2011 04:27 AM

>> Best mobile redirect script?
 
Anybody got some suggestions on this? Just want to detect a mobile device and send them to a matching mobile page.

Thanks :thumbsup

Oracle Porn 07-27-2011 04:29 AM

htaccess

k0nr4d 07-27-2011 04:31 AM

PHP Code:

function detectMobile() {
    
$user_agent $_SERVER['HTTP_USER_AGENT'];
    switch(
true) {
        case (
stripos($user_agent,'android'));  
             
$isMobile true;
        break; 
        case (
stripos($user_agent,'iphone')||stripos($user_agent,'ipod'));
            
$isMobile true
        break;
        case (
stripos($user_agent,'opera mini')); 
             
$isMobile true
         break; 
        case (
stripos($user_agent,'blackberry'));
            
$isMobile true;
        break;
        case (
preg_match('/(mini 9.5|vx1000|lge |m800|e860|u940|ux840|compal|wireless| mobi|ahong|lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|samu7|samu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|i250|sprint|w398samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|s302|-x113|novarra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|foma|samsu|vx8|vx9|a1000|_mms|myx|a700|gu1100|bc831|e300|ems100|me701|me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|m50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |sonyericsson|samsung|240x|x320vx10|nokia|sony cmd|motorola|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo|palm os|palm|hiptop|avantgo|fennec|plucker|xiino|blazer|elaine|iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile)/i',$user_agent));
            
$isMobile true
        break;
    }
    return 
$isMobile
}
if(
detectMobile()) {
header("Location: http://www.blah.com"); 
exit(); 



nyllover 07-27-2011 04:33 AM

htaccess FTW

Lilit 07-27-2011 04:33 AM

htaccess for the win! Check out our htaccess code. If you want to direct each mobile device to a separate landing page you'll have to expand it though.

nyllover 07-27-2011 04:34 AM

And this is the code...

Quote:

RewriteEngine on
RewriteCond %{HTTP:X-Wap-Profile} ^.+$ [OR]
RewriteCond %{HTTP:Profile} ^.+$ [OR]
RewriteCond %{HTTP_ACCEPT} ^.*(text/vnd.wap.wml|application/vnd.wap.xhtml\+xml).*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(android|blackberry|iphone|ipod|ipad|opera\ mini|vantgo|blazer|elaine|hiptop|palm|plucker|xiin o|kindle|mobile|mmp|midp|pocket|symbian|smartphone |treo|up.browser|up.link|vodafone|wap|sony|nokia|s amsung|epoc|palm|wap1.|wap2.|xda-).*$ [NC]
RewriteRule ^(.*)$ http://YOURURL.COM/ [R,L]


Roald 07-27-2011 04:37 AM

Wow thanks for the quick reply!

boldy 07-27-2011 04:52 AM

Does one also have a script where, we can detect this trough 3 layers of html cache, reversed proxy, memcached and filecache ? and 90 % the users never reaches the .htaccess or php code . Without javascript because this would cause a full or partial page reload...

I'm such a n00b ...

Roald 07-27-2011 05:05 AM

Quote:

Originally Posted by boldy (Post 18310643)
Does one also have a script where, we can detect this trough 3 layers of html cache, reversed proxy, memcached and filecache ? and 90 % the users never reaches the .htaccess or php code . Without javascript because this would cause a full or partial page reload...

I'm such an idiot...

There I fixed it for you.

alias 07-27-2011 05:59 AM

Posting to save thread to easily find later.

fris 07-27-2011 08:03 AM

http://detectmobilebrowsers.mobi/

Jack Sparrow 07-27-2011 08:31 AM

Quote:

Originally Posted by Roald (Post 18310649)
There I fixed it for you.

You can even redirect the mobile surfers based on their geo.
Hit me up if you need the code for it.

Oren-Pcash 07-27-2011 08:55 AM

We have all those scripts on Pussycash's Mobile Promo-tools and they r doing great:thumbsup
let me know for any help you might need here:winkwink:


All times are GMT -7. The time now is 03:08 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123