Skip to content

Instantly share code, notes, and snippets.

@matthewpennell
Created May 15, 2011 14:18
Show Gist options
  • Save matthewpennell/973194 to your computer and use it in GitHub Desktop.
Save matthewpennell/973194 to your computer and use it in GitHub Desktop.
Regular expressions in .htaccess
# Set browser and version environment variables based on the visitor's browser
SetEnvIfNoCase User-Agent (Opera|Chrome|Version|Firefox|MSIE)[\/|\s](\d+)\. browser=$1 version=$2
SetEnvIf browser Version browser=Safari
SetEnvIf browser MSIE browser=IE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment