2

We got site written on Drupal.

We want to make Nginx caching but there is one problem we met.

Nginx caching works perfect, but if user A will go to page http://domain.com and nginx cache it. User B use mobile theme http://domain.com/?theme=mobile and went to http://domain.com/ , he will see desktop version instead of mobile version.

I want to make something like http://domain.com/any/url/path for desktop version and http://domain.com/mobile/any/url/path

Is it possible? Where can I found information about how to do it?

0

2 Answers 2

1

If you are using Drupal6 Have a look at Mobile Tools module.

The Mobile Tools module provides Drupal developers with some tools to assist in making adjustments to your site based on the visitor's device.

Once you install the module you can define different paths for desktop and mobile, then browser will detect the device and redirect to corresponding path. For Drupal 7 Mobile Switch module is the alternative

3
  • And that bypasses/works with Nginx caching automatically? Could you outline how? I'm struggling to see it. I'd also be wary of installing a dev only module for something so important
    – Clive
    Commented Nov 13, 2015 at 15:41
  • The module I have used is for Drupal 6, the Mobile Switch module is for Drupal 7. I am not sure if it bypasses nginx cache.
    – Shabir A.
    Commented Nov 13, 2015 at 15:53
  • It doesn't suits to me because I have not only mobile and desktop version but version for people with disabilities
    – Spyric
    Commented Nov 14, 2015 at 10:30
1

It was easily than I expect.

We use ThemeKey module so I added some rules depends on url like "drupal:path visuallimpaired/%" and just make my own plugin that use hook_url_inbound_alter and hook_url_outbound_alter to add and remove prefixes, and it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.