![]() |
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. |
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] |
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
|
Quote:
No Need to redirect.I got what you need. Please ping me on skype. skype id CPRenato |
Quote:
As fast as possible |
Use mobile pop code, dont use mobile redirect
|
Quote:
. . . |
Quote:
|
Thanks for the code!
Its for redirecting the mobile traffic to the .m version of the same website. |
Quote:
<?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 |
Can also make CSS changes by screen width:
Code:
@media only screen and (max-width: 1440px) { } /* small desktop */ |
Just go there and grab the one you need:
Detect Mobile Browsers - Open source mobile phone detection |
Listen to HowlingWulf :2 cents: :thumbsup :pimp
|
All times are GMT -7. The time now is 11:01 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc