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)
-   -   Good htaccess mobile redirect code? (https://gfy.com/showthread.php?t=1167671)

getcontentnow 06-02-2015 02:16 AM

Good htaccess mobile redirect code?
 
Can somebody help me with an "uptodate" mobile redirect code for .htaccess?

I did google it, but theres to much crap out there.

gebu 06-02-2015 03:18 AM

RewriteEngine On
RewriteRule \.(jpg|png|gif|jpeg|bmp)$ - [L]
RewriteCond %{HTTP_USER_AGENT} (mobile|android|blackberry|brew|cldc|docomo|htc|j2 me|micromax|lg|midp|mot|motorola|netfront|nokia|ob igo|openweb|opera.mini|palm|psp|samsung|sanyo|sch| sonyericsson|symbian|symbos|teleca|up.browser|voda fone|wap|webos|windows.ce) [NC]
RewriteRule ^(.*)$
http:// yoururl. com [R=302,L]

Matyko 06-02-2015 08:24 AM

this is a good code gebu posted, but don't do this. Get your mobile traffic a proper landing page On Your Site. Otherwise Google will fuck your site's ass. :pimp

campartner 06-02-2015 08:43 AM

Quote:

Originally Posted by getcontentnow (Post 20488083)
Can somebody help me with an "uptodate" mobile redirect code for .htaccess?

Hi mike

No Need to redirect.I got what you need.
Please ping me on skype.

skype id CPRenato

Ferus 06-02-2015 11:12 AM

Quote:

Originally Posted by Matyko (Post 20488289)
this is a good code gebu posted, but don't do this. Get your mobile traffic a proper landing page On Your Site. Otherwise Google will fuck your site's ass. :pimp

This +1.
As fast as possible

AlexTmz 06-02-2015 03:09 PM

Use mobile pop code, dont use mobile redirect

Paul&John 06-02-2015 03:13 PM

Quote:

Originally Posted by matyko (Post 20488289)
this is a good code gebu posted, but don't do this. Get your mobile traffic a proper landing page on your site. Otherwise google will fuck your site's ass. :pimp

+1
.
.
.

Jel 06-02-2015 04:25 PM

Quote:

Originally Posted by Matyko (Post 20488289)
this is a good code gebu posted, but don't do this. Get your mobile traffic a proper landing page On Your Site. Otherwise Google will fuck your site's ass. :pimp

it depends what page(s) you are using it on... not all traffic is se traffic :)

getcontentnow 06-02-2015 11:29 PM

Thanks for the code!
Its for redirecting the mobile traffic to the .m version of the same website.

Matyko 06-02-2015 11:44 PM

Quote:

Originally Posted by getcontentnow (Post 20488903)
Thanks for the code!
Its for redirecting the mobile traffic to the .m version of the same website.

There are better solutions to make this happen. For example we use this on a very simple site, Above <head> !! :

<?php
if(! empty($_SERVER['HTTP_USER_AGENT'])){
$useragent = $_SERVER['HTTP_USER_AGENT'];
if( preg_match('@(iPad|iPod|iPhone|Android|BlackBerry| SymbianOS|SCH-M\d+|Opera Mini|Windows CE|Nokia|SonyEricsson|webOS|PalmOS)@', $useragent) ){
header('Location: ./mobile/');
}
}
?>

This redirects users to domain.com/mobile

But you can also determine a screen width in css to show the mobile site if the width is smaller than xxx pixels... Not sure how this works, but others will help to finetune this method :pimp

HowlingWulf 06-03-2015 08:15 AM

Can also make CSS changes by screen width:
Code:

@media only screen and (max-width: 1440px) { }  /* small desktop */

@media only screen and (max-width: 1280px) { }  /* laptop */

@media only screen and (max-width: 1024px) { }  /* tablet landscape */

@media only screen and (max-width: 768px) { }    /* tablet portrait */

@media only screen and (max-width: 480px) { }    /* mobile landscape */

@media only screen and (max-width: 320px) { }  /* mobile portrait */


hdbuilder 06-03-2015 08:25 AM

Just go there and grab the one you need:

Detect Mobile Browsers - Open source mobile phone detection

Matyko 06-03-2015 10:13 AM

Listen to HowlingWulf :2 cents: :thumbsup :pimp


All times are GMT -7. The time now is 09:06 PM.

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