Web design, programming, graphics, and pretty much anything else I care about.


Apache redirect, with cookie support

This will redirect visitors that come from various mobile devices to another website (a mobile site.) It has added support for a cookie, so that mobile users can still opt to visit the full site.

The first block checks to see if it is a mobile device and there is neither a cookie nor a url parameter set. If those conditions are met, redirect the visitor to the mobile site. The second block looks to see if the url parameter is set and there is no cookie. If those conditions are met, set a cookie for the user.

Multisite using alias in Apache config

People are always having issues setting up a multisite using Drupal. Part of the hangup is working out the symbolic links you have to create. Why? At the heart of it, Apache needs to find the index.php in the root of the Drupal installation, regardless of what URL is used to access it.


It doesn't matter what address you are using, as long as you do something to point Apache to your index.php file. For some people this means using a symbolic link in your Drupal root, like so:

Apache rewrite for subdirectory-based Drupal multisite

In a multisite setup where there is a mix of sites based on subdomains, as well as subdirectories, the rewrite can be more complicated. Use this for the subdirectory based sites: