View Single Post
Old 11-22-2009, 04:11 PM  
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
What is the most SE friendly mobile redirect script to use?

I'm just setting up some new whitelabels with pimproll (great job BTW guys as usual )

Which works best and doesn't harm your SEO?

Code:
<script type="text/javascript">
if (navigator.userAgent.match(/(opera mini|ipod|iphone|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo|nokia|blackberry|pre\/0.1|android)/i)) {
    // default for all other mobile browsers
    location.replace("http://nameofthedomaincom/");
}
</script>
or,

Code:
<?php
if (preg_match('/(opera mini|ipod|iphone|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo|nokia|blackberry|pre\/0.1|android)/i', $_SERVER['HTTP_USER_AGENT'])) {
    header('Cache-Control: no-transform'); 
    header('Vary: User-Agent, Accept'); 
    header('Location: http://domaingoeshere.com'); 
    exit;
}
?>
Or is there a better more SE friendly way to do it?

Just double checking here, i'm sure either of the ways above will work perfectly.

Thanks for any help
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote