Author Topic: page-by-page redirect to another website for a mobile version  (Read 4212 times)

Offline MissyW

  • Posts: 42
  • Gender: Female
I have an existing website that is getting a good amount of Google traffic.  Now I want to create a version for mobiles - preferably another website, not just another wb template (as it will have reduced content).  The mobile website could sit on a sub-domain or a separate domain. 

I have read about the isMobile() snippet.  On this post http://www.websitebaker2.org/forum/index.php/topic,19589.msg133311.html#msg133311 it says you can direct to another website if a mobile device is detected.  But really, I want a page-by-page redirect, as most of my traffic land on pages other than the home page, so I would want to redirect them to the corresponding page on the mobile website.

Is this possible with isMobile() snippet?  Am I on the right track? No-one has posted on the isMobile() snippet topic since March last year - perhaps because of Rudd's comment that
Quote
The problem with the handheld stylesheets is that not all mobile browsers support them.
  But if I am redirecting to a mobile website (not a different stylesheet), this would not be a problem, I think???

(As you can probably tell, I don't have a great technical grasp of this problem).

Offline Ruud

  • Posts: 3649
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: page-by-page redirect to another website for a mobile version
« Reply #1 on: January 05, 2012, 10:33:09 AM »
The isMobile function only detects if the visitor is using a mobile device.
The next step is up to you.

Redirecting to a subdomain to exactly the same page would be something like:

Code: (untested) [Select]
<?php
if ( isMobile() ) {
  
header'Location: http://subdomain.myserver.com'.$_SERVER['REQUEST_URI'] );
  return;
}
?>


 

postern-length