When PHP isn’t loaded, redirects won’t work. So any page caching will interfere with your implementation. W3TC has user agent groups that allow you to pass requests to respective themes or URLs if you want.
Hi there, I am having the same issue. When I am using a mobile detection script to redirect mobile users to a mobile compatible URL, it deactivates when W3Total Cache is active. Any workaround for this?
Go to topic “User Agent Groups” and click on “Create a group”. Select the theme you want to use for your mobile or fill “Redirect users to”.
At “User agents” enter the agent names of the mobiles to use (e.g. ipad). Spaces and special characters have to be escaped with backslashes! See the other agent names for examples.
Move your new group to the top.
@jochent, clearly you mean that this worked for you?
Hi I remember looking over this recently.
A colleague has since taken over the project, but I think in my case changing the action hook to: parse_query (maybe send_headers) would have solved my problem. My colleague implemented an .htaccess solution outside of WordPress so never had a chance to try it personally.
Yes using the user agent groups should work in W3TC but there are other caching plugins that will overwrite/cancel the redirect..
Like I said I am no longer on the project but my guess is that this is the right place to to detect the user agent and redirect and because the you should be able to detect the user agent and no headers should have been sent yet.
If you get a chance to try this please let me know, could come in handy in the future.
@frederick, yes I use this method to manage two caches for the same theme.
The reason was a code snippet in the WP header template which adjusts some sizes for the ipad.
If a redirect to another URL is calculated in the script, I think “– Pass-through –” should be selected and “Redirect users to” should be empty.
Sorry, my answer was intended for @calliewallie, not the original question.
Thanks @jochent I have tried:
Group name: 1.High
Enabled: (checked)
Theme: Pass-Through
Redirect Users to: (blank)
User Agents: smartphone
and it doesn’t work…? I’ve also tried with ‘Redirect users to” with the mobile url in place and can’t get it working. Any other suggestions? Thanks in advance 🙂
I’m working with the developer to address this.