Per session caching issue

I have a WordPress website and it’s hosted by Hostgator.

  • I have two versions of the homepage which are served depending on the detected user agent.
  • Now the problem is that the user agent is not detected correctly on the first visit, but only on the second visit.
  • Another thing I’ve found that if I delete the cookies after the first visit (specifically: PHPSESSID) it does not detect the right user agent as long as i keep deleting the cookie after each page view.

These are the $_SERVER['HTTP_USER_AGENT'] values I am getting:

Read More

First view (the incorrect one):
Mozilla/5.0 (X11; CrOS x86_64 6680.78.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.102 Safari/537.36

Second view (the correct one):
Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53

Any idea how can I prevent this sort of caching?

Related posts

Leave a Reply