-
-
Save KABBOUCHI/024907fd804648417956b5e490fc4eda to your computer and use it in GitHub Desktop.
NGINX redirect to app store and google play 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
location = /gotoapp { | |
if ($http_user_agent ~* "iphone|ipod|ipad|appletv") { | |
return 301 https://www.apple.com/lae/ios/app-store/; | |
} | |
if ($http_user_agent ~* "android") { | |
return 301 https://play.google.com/store; | |
} | |
if ($http_user_agent ~* "Windows") { | |
return 301 https://www.microsoft.com/store/apps?rtc=1; | |
} | |
if ($http_user_agent ~* "Linux") { | |
return 301 https://www.linux.org/; | |
} | |
if ($http_user_agent ~* "Mac") { | |
return 301 https://www.apple.com/mac/; | |
} | |
return 301 /cant-detect; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment