How to make nginx to redirect multiple subdomains?

How do I redirect outdated browsers with an Nginx map?

  • 0    http://...         http://stackoverflow.com/questions/23460195/how-to-redirect-outdated-browsers-with-nginx-map#                                            We have an NginX balancing proxy in front of our web application. Unfortunately there is not enough development resources to support outdated browsers, yet :( We want to redirect members of our web project to /outdated page by their browser user-agent data like this (https://www.in2circle.com/outdated). For some reason we don't want to load back-end with User-Agent content analysis logic. I've heard it's easy to do with NginX http://nginx.org/en/docs/http/ngx_http_map_module.htmlIf somebody did so, can you help me with examples and explanations, please!

  • Answer:

    Next solution works pretty good and is exactely what I wanted:     map $http_user_agent $outdated {         default 0;         "~MSIE [1-9]\."  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;     }         if ($outdated = 1){         rewrite ^ /outdated redirect;     } Thanks everyone for Help/Answers.

Alexander Arutinyants at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.