Skip to content

Instantly share code, notes, and snippets.

@matthewpennell
Created May 15, 2011 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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