Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access full website with htaccess mobile redirect

Status
Not open for further replies.

bwaltz

Programmer
Sep 26, 2011
1
US
Hey guys,

I have a mobile site that gets redirected through the .htaccess file. There is a link on the mobile site to view the full site. But, when the user clicks on the link, they are always redirected back to the mobile site. I have set up a script to run when the user clicks on the link to access the full site that creates a cookie "mobile=no" on the mobile site.

Im having a real hard time trying to configure the .htaccess file so that, if this cookie is set, don't redirect.

Here is the code:


RewriteCond %{HTTP_COOKIE} !^mobile=no$
RewriteCond %{HTTP_HOST} !^m\.stage\.sunjournal\.com$
RewriteCond %{HTTP_USER_AGENT} "android|iPhone|blackberry|iemobile|operamobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^(.*)$ [L,R=302]
 
Cookies and sessions are not shared across subdomains by default, for obvious reasons.

You may be able to use mod_session to implement "server wide sessions"

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top