M
M
Maxim Timofeev2015-12-28 13:34:40
Nginx
Maxim Timofeev, 2015-12-28 13:34:40

How to do a reverse regex?

There is a redirect in nginx from the main to the mobile:

if ( $http_user_agent ~* (windows\smobile|windows\sce|iphone|ipod|midp|symbian|series\s60|s60|nokia|аndroid|blackberry) ){ rewrite ^/(.*) m.site.ru/$1 permanent; }

How to do the reverse? How to make a condition for non-equality to a regular expression, what to register for a redirect from a mobile domain to the main one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cat Anton, 2015-12-28
@webinar

Negative operators “!~” and “!~*” are also available.

nginx.org/en/docs/http/ngx_http_rewrite_module.html#if
Replace ~*with!~*

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question