user1717475
user1717475

Reputation: 249

How to redirect from mobile website to full site?

I was trying to figured out how to redirect from my mobile website to full site. When I create a button e.g.: "View Full Site" - it did not go to the full site, instead it go back to mobile website. I use Google Code: http://code.google.com/p/phpmobilizer/ to convert from normal website to mobile site. I was wondering if you know some php code that can redirect from mobile site to full site?

Here is the site I am currently working on http://www.roofpro.ca

Thanks! Christie

Upvotes: 1

Views: 3826

Answers (2)

user1477388
user1477388

Reputation: 21440

Just set a session if the user wants to go from mobile to desktop version. Do like this:

<a href="/index.php?goToDesktop=1">Go to desktop version</a>

Then, at the top of your index.php file:

<?php
session_start();
if ($_GET['goToDesktop'] == 1)
{
  $_SESSION['desktop'] = 1;
}

// then in your auto-mobile-detect, check for the variable first
if ($_SESSION['desktop'] != 1)
{
  // check for mobile and redirect
}

Upvotes: 1

Louis Huppenbauer
Louis Huppenbauer

Reputation: 3714

The problem you're facing is that you're being redirect back to your mobile domain again as soon as you're on your main domain with your mobile device.

You could try something like the following:

If the user wants to access the normal version, set a session variable and redirect him to the normal domain. On the normal domain, only execute the phpmobilizer as long as the session var for only accessing the normal domain hasn't been set.

Upvotes: 0

Related Questions