Admin settings

In the Acquia Cloud platform, you can redirect site visitors in the Varnish layer, based on the devices they are using, as determined by the user-agent HTTP header in the request. You can do this by using your web site's .htaccess file to set HTTP headers in the response.

However, when you configure Acquia Cloud to use PHP-FPM, the .htaccess file is no longer able set http headers and these redirects stop working. To get the redirect headers to output again, you'll need to generate them in PHP code instead.

The Acquia Mobile redirect module uses Drupals hook_boot() to check the current hostname against configured mobile, tablet and desktop URLs and sets the correct varnish headers on the page to provide device-specific redirects through Varnish, when a page request is handled by Drupal itself.

By using this module, you don't need to add code to your settings.php file and the configure device URLs automatically become exportable in a feature if you have enabled the the strongarm module.

Installation

  1. Download the module and extract it to sites/all/modules or install it using drush dl acquia_mobile_redirect.

Configuration

  1. Go to admin/config/system/acquia-mobile-redirect and enter device-specific URLs for the dekstop, tablet and mobile versions of the site. Leave any of the fields blank to not output a URL for that device type. Device switching now works!
  2. Optionally, configure the Acquia Mobile Redirect Links block and place it somewhere on your site. This block allows users to override the device selection.

Theming

You can target div#block-acquia-mobile-redirect-links to style the mobile redirect block. Each of the device-specific list items has the device name as a class you can use to target it. The links themselves have an ID that is used by the redirection JavaScript, so only change the IDs if you change the JS too.

Honourable mentions

Jibran Ijaz wrote the javascript device switcher and browser-cookier.

More

See the Acquia documentation for more information.

Supporting organizations: 

Project information

Releases