Created
August 5, 2019 09:19
-
-
Save ragingwind/f19a2751adccc503074184f611e6864a to your computer and use it in GitHub Desktop.
Redirect old-classic browser including IE 11
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
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
map $http_user_agent $outdated { | |
default 0; | |
"~MSIE [1-10]\." 1; | |
"~Trident/[5-7]\." 1; | |
"~Mozilla.*Firefox/[1-9]\." 1; | |
"~Mozilla.*Firefox/[0-2][0-9]\." 1; | |
"~Mozilla.*Firefox/3[0-1]\." 1; | |
"~Opera.*Version/[0-9]\." 1; | |
"~Opera.*Version/[0-1][0-9]\." 1; | |
"~Opera.*Version/2[0-1]\." 1; | |
"~AppleWebKit.*Version/[0-6]\..*Safari" 1; | |
"~Chrome/[0-9]\." 1; | |
"~Chrome/[0-2][0-9]\." 1; | |
"~Chrome/3[0-3]\." 1; | |
} | |
server { | |
listen 80; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
if ($outdated = 1) { | |
rewrite ^ /outdated.html redirect; | |
} | |
} | |
location = /outdated.html { | |
root /usr/share/nginx/html; | |
index outdated.html; | |
} | |
} | |
} |
Very helpful for me
I think 1-10 is right. the last number of msie is 10 https://www.whatismybrowser.com/guides/the-latest-user-agent/internet-explorer
Yeah maybe, however a regex group is not like a number until another number it is a bunch of ascii characters. So with 1-10 you say you allow the digits 1, 1 and 0 just once, not 1-10 like decimal.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think 1-10 is right. the last number of msie is 10 https://www.whatismybrowser.com/guides/the-latest-user-agent/internet-explorer