Anyone know how to redirect to a mobile site??

bingading

Registered Member
Joined
May 23, 2011
Messages
82
Reaction score
54
does anyone know of a simple way to detect the use of a mobile device and redirect it to a different website???

Please help thanks!
 
are u using apache server? what type of landing pages are u using (dynamic/static)? give us more details and we might be able to help ;)
 
I am using static pages. so i just want www.example.com to detect if i am using a mobile or not... if so redirect to m.example.com if not then stay at the www.
 
if you are using wordpress, there are free plugins available
 
I am using static pages. so i just want www.example.com to detect if i am using a mobile or not... if so redirect to m.example.com if not then stay at the www.
if they are static pages, u have two options, use the web server to redirect (best way) or add a javascript to your pages to detect and redirect (not so good and not seo friendly). check with your host what kind of server they are running?
 
It's easy, just do it based on site width:

put this in <head></head>:
Code:
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "http://m.site.com";
}
//-->
</script>

some browsers don't have JS on, you should stick something in noscript for that. not sure what though, there are some php you might use.

I think most just use JS though.
 
lol @ g00g, did u notice they happened to 'forget' iphone in that class, not much biased.. really.. :rolleyes:

Its in there - but wouldn't of put it past them 'forgetting' :)

Code:
protected $devices = array(
        "android"       => "android",
        "blackberry"    => "blackberry",
        "iphone"        => "(iphone|ipod)",
        "opera"         => "opera mini",
        "palm"          => "(avantgo|blazer|elaine|hiptop|palm|plucker|xiino)",
        "windows"       => "windows ce; (iemobile|ppc|smartphone)",
        "generic"       => "(kindle|mobile|mmp|midp|o2|pda|pocket|psp|symbian|smartphone|treo|up.browser|up.link|vodafone|wap)"
    );
 
If you have trouble I have working example code I can send you.

From my experience, make sure you redirect from mobile to non mobile as well - so desktop users don't see your mobile site.

Also make sure you restrict your mobile sites so google crawler doesn't index (to avoid dupe content).
Google also has a mobile bit as well so make sure you declare the mobile site accordingly.

Lastly, I would advise to think about it carefully - I had a mobile site for a while but ended up scraping it as the mobile ads didn't generate any revenue, and when I think about it, with smart phones being so popular, most phones are quite capable of displaying a desktop page pretty well.

So what I would say is make sure your mobile site really is providing and enhanced user experience compared to your desktop version.
 
Back
Top