Another Apache config file for mobile device detection

Recently I posted an Apache configuration file that allows you to detect mobile devices and pass a query parameter to the back-end that informs your web application what type of device is accessing your website. This without the need for device detection in your back-end (e.g. Drupal).

The main goals for that script where:

  • 1 url for both the mobile and desktop site

Simple Apache configuration file for mobile device detection

From time to time I get questions about caching strategies and mobile devices. Definitely when you want to create different responses in the back end based on the device AND you have strong caching strategies, things get very tricky.

An example scenario in Drupal (but can relate to any CMS) is where you boost performance by storing the generated pages as static files (see Boost).

These solutions rely heavily on Apache in a way that Apache delivers the static files in case these files exist. Otherwise it passes the request to the CMS.