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.

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!

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.

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?

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/>

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!