WebsiteBaker Community Forum

General Community => Global WebsiteBaker 2.8.x discussion => Topic started by: MissyW on January 05, 2012, 05:07:39 AM

Title: page-by-page redirect to another website for a mobile version
Post by: MissyW on January 05, 2012, 05:07:39 AM
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 https://forum.WebsiteBaker.org/index.php/topic,19589.msg133311.html#msg133311 (https://forum.WebsiteBaker.org/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).
Title: Re: page-by-page redirect to another website for a mobile version
Post by: Ruud 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;
}
?>