Created
April 25, 2013 15:27
-
-
Save fnhipster/5460604 to your computer and use it in GitHub Desktop.
Mobile/Desktop htaccess redirect
This file contains 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
# MOBILE REDIRECT | |
RewriteCond %{REQUEST_URI} !/mobile.*$ | |
RewriteCond %{REQUEST_URI} !/hub.*$ | |
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] | |
RewriteRule ^(.*)$ /mobile [L,R=302] | |
# if a user is accessing a mobile page from desktop then show desktop version | |
RewriteCond %{HTTP_USER_AGENT} "!android|!blackberry|!iphone|!ipod|!iemobile|!opera mobile|!palmos|!webos|!googlebot-mobile" [NC] | |
RewriteRule ^mobile/(.*)$ / [L,R=302] | |
# END MOBILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment