views:

867

answers:

1

I am basically producing a simple, watered down, iPhone specific sites on a sub-domain of the original.

I know of various auto redirects, like the htaccess & user agent scripts/rules that take the user straight to the iPhone specific site, but these scripts do not cater for someone who has come from the iPhone specific site that wants to view the full version because they are just redirected again back to the iPhone specific site.

Do you see my problem?

My favoured form of redirect is htaccess, is there a way to disregard an htaccess rule if the user has come from the sub (iPhone specfic) domain so that they can view the main site without problem?

Of course I am open to suggestion if the htaccess rule isn't the way to go.

Many thanks

+1  A: 

What about setting a cookie on the client browser that indicates the user wants to see the full site. Then check for the presence of that cookie before doing any redirect logic.

Adam B
That's a good idea but I'm not sure how I would implement it...Would I set the cookie only when the user clicks the 'View main site' link? And how would this be done? I have experience with the jQuery cookie plugin, can this manage what I need?Thank you by the way
Zander
I'm not familiar with jQuery but I would assume so. When a user hits the front page of your site, check for the cookie. If not present do your user-agent check and redirect to the mobile.whatever.com subdomain. Otherwise leave the user where they are. On your mobile site, ijf the user then clicks to see the full version, set a cookie with a very long expiration time. Likewise you can provide a link that deletes the cookie to redirect the user to the mobile site again. Basically the presence of this cookie will be your trigger to redirect or not.
Adam B
Ok, I think I've got it, I may come back here for more help though.Thank you
Zander