www.webdeveloper.com
Results 1 to 2 of 2

Thread: After Mobile Redirect Not Working

Hybrid View

  1. #1
    Join Date
    Mar 2007
    Posts
    5

    After Mobile Redirect Not Working

    Hi all,

    I have a bit of php code on index.php of my main site, here... http://dominionroofing.com/

    This code redirects visitors on mobile browsers to my mobile version of the site, here... http://dominionroofing.com/m/

    On the mobile site, the visitor has the option to view the full site, as follows...
    HTML Code:
    <a href="http://dominionroofing.com/?mode=desktop">View Full Website</a>
    Here is the part of the php code that is supposed to redirect to the desktop if the link is clicked...

    Code:
    switch($_GET['mode'])
    {
    case 'mobile':
    $mode = "mobile";
    break;
    case 'desktop':
    $mode = "desktop";
    break;
    default:
    $mode = is_mobile() ? "mobile" : "desktop";
    break;
    }
    
    if ($mode == "mobile")
    {
    header ("Location: http://dominionroofing.com/m/");
    return;
    }
    However, this is not working, at least not for me on my iphone. I have this exact code installed on quite a few other sites, and it works on all of them but this one. Hosting is GoDaddy shared host, but I have at least two other sites installed on GoDaddy servers that are working perfectly.

    Any and all help is much appreciated.

    Tom

  2. #2
    Join Date
    Mar 2007
    Posts
    5

    Never mind...

    Never mind... I got it working.

    I added the following to the main site's htaccess file...

    Code:
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html
    RewriteRule ^index\.html$ http://dominionroofing.com/ [R=301,L]
    I am not sure why this made a difference, but as soon as I did that the View Full Website link started working as intended.

    Perhaps there is a better fix?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles