Created
October 9, 2017 09:15
-
-
Save ankibalyan/388d7de1f5475d8ed85b367e490c7551 to your computer and use it in GitHub Desktop.
Redirects from nginx based on user agent
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
# APP redirects | |
if ($http_user_agent ~* "iphone|ipod|ipad|appletv") { | |
rewrite ^/adl/(.*)$ https://itunes.apple.com/us/app/apple-store/id375380948?mt=8¶ms=$1 redirect; | |
} | |
if ($http_user_agent ~* "android") { | |
rewrite ^/adl/(.*)$ https://play.google.com/store/apps/details?id=com.app.witpay¶ms=$1 redirect; | |
} | |
if ($http_user_agent ~* "Windows") { | |
rewrite ^/adl/(.*)$ https://example.com/$1 redirect; | |
} | |
if ($http_user_agent ~* "Linux") { | |
rewrite ^/adl/(.*)$ https://example.com/$1 redirect; | |
} | |
if ($http_user_agent ~* "Mac") { | |
rewrite ^/adl/(.*)$ https://example.com/$1 redirect; | |
} | |
# rewrite ^/adl/(.*)$ https://example.com/$1 redirect; | |
# PWA redirect | |
if ($is_mobile) { | |
return 301 https://m.example.com/$request_uri; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment