A
A
alexxzhuravlev2016-03-09 19:33:45
Nginx
alexxzhuravlev, 2016-03-09 19:33:45

How to write a redirect depending on the browser in Nginx?

Hi all!
How do I redirect to nginx. The bottom line is, if the Opera browser - we do a redirect.
I try to write like this:
map $http_user_agent $outdated {
default 0;
"~Opera.*Version/[0-9]\." one;
}
if ($outdated = 1){
rewrite ^ /outdated redirect;
}
This does not work in the server section, I cannot declare the http section in the virtual host.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2016-03-09
@Nc_Soft

nginx.org/ru/docs/http/ngx_http_browser_module.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question