Created
August 23, 2013 21:04
-
-
Save geekbuntu/6324008 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################################### | |
# Redirect to separate directory for mobile site | |
###################################################### | |
# Don't redirect if we're already there! | |
RewriteCond %{REQUEST_URI} !^/mobile/.*$ | |
# Check Cookie to (en|dis)able redirect to mobile or stay on desktop | |
RewriteCond %{HTTP_COOKIE} !^.*mobile.*$ [NC] | |
# Check accept header for tell-talse signs of mobile devices | |
RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC,OR] | |
# Check User Agent for known mobile browsers | |
RewriteCond %{HTTP_USER_AGENT} "sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera mini|IEmobile|DoCoMo" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "nitro|j2me|midp-|cldc-|netfront|mot|up\.browser|up\.link|audiovox"[NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-|ipad|ipod|iphone"[NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc"[NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone\/|wap1\.|wap2\.|mobile safari|android"[NC] | |
# Rewrite the URL to that of the mobile directory | |
RewriteRule ^(.*)$ /mobile/ [L,R=302] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment