Skip to content

Instantly share code, notes, and snippets.

@revolunet
Created June 7, 2011 16:45
Show Gist options
  • Select an option

  • Save revolunet/1012638 to your computer and use it in GitHub Desktop.

Select an option

Save revolunet/1012638 to your computer and use it in GitHub Desktop.
tablet detection (android/ipad)
#
# redirect requests if not iPad or Android tablet
# NB "mobile safari" is the UA for Android phones
#
RewriteEngine On
SetEnv isAndroidTablet=NO
BrowserMatchNoCase Android isAndroidTablet=YES
BrowserMatchNoCase "Mobile Safari" isAndroidTablet=NO
# reject iphones, ipods, android mobiles flavours for main domain
RewriteCond %{HTTP_HOST} ^mobile\.revolunet\.com [NC]
RewriteCond %{HTTP_USER_AGENT} !^.*ipad.*$ [NC]
RewriteCond %{ENV:isAndroidTablet} !=YES
# exclude some IP
# RewriteCond %{REMOTE_ADDR} !128.128.128.128
RewriteRule (.*) http://www.revolunet.com [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment