SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2011
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Bypass Mobile Redirect?

    Hi there,
    I am trying to add a 'full site' button to my mobile site so that viewers have the option to view the non-mobile version of the website. I started using this website: http://www.squidoo.com/php-mobile-redirect and followed the steps up until I was supposed to put the 'setcookie("mobile","m", time()+3600, "/");' code into the main page of my mobile site. Problem is, my mobile site is made with html not php. So is there a way of enabling php in an html doc? I tried changing the .htaccess file but then the site just completely wouldn't work. OR if anyone has any other good ways of bypassing the redirect, please let me know.

    Just so you know, the full website is www.example.com, and the mobile redirect takes users to www.example.com/m/ , so the mobile site is just a folder in the root directory. Thanks.

  2. #2
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could rename your index.html to index.php. That should allow the page to run php code, if you have php installed.
    Each day is a learning experience.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2011
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by CSU-Bill View Post
    You could rename your index.html to index.php. That should allow the page to run php code, if you have php installed.
    Easy as that? Thanks!

  4. #4
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are other ways of enabling PHP, but since I have seen so many different ways, I think the .htaccess entries depend on the hosting setup. I do have a site setup running *.html files as php, so it can be done.
    Each day is a learning experience.

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2011
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd like to bump this thread up because after a couple of days of this: http://www.squidoo.com/php-mobile-redirect method working, it just stopped working and instead of mobiles being first directed to the mobile version they just went straight to the full site. I tried deleting everything that I had done and started over, only to have it work a couple of times and then go back to just viewing the full site right off the bat.

    Anyone have any ideas on why it would do this and what i could do to change it? Or does anyone have any other methods for bypassing the mobile redirect in order to have a view full site option?

  6. #6
    SitePoint Member
    Join Date
    Dec 2011
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Clear your cookies...

    Make sure you are clearing your cookies on your mobile device if you are testing. The code is setting a cookie to expire in 1 hour. So if you visit the mobile site and select view full site, you have a cookie set for 1 hour. That is what is bypassing the mobile redirect.


    <snip/>
    Last edited by Mittineague; Jan 3, 2012 at 13:58. Reason: Please wait until you get your signature for your links.

  7. #7
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm used the same script(http://www.squidoo.com/php-mobile-redirect) but I cannot get the "View Full Site" link to work. I've placed the setcookie("mobile","m", time()+3600, "/"); on the index page of my mobile site but I get redirected back to the mobile site when I click on the view full site link. I'm testing on an iPhone 4S, cleared out cookies/data/history several times to see if there was any change. Nothing. Any help would be much appreciated!


Bookmarks

Posting Permissions

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