V
V
VMCLOUD2014-10-02 23:51:07
Nginx
VMCLOUD, 2014-10-02 23:51:07

How are the rewrite rules for nginx?

Actually, bright heads, tell me how to properly implement rewrite for nginx ?!
Introductory:
There is domain.com/index.php - everything is ok with it. There is also domain.com/mod/auth.php - everything is ok with it too. iOS and Android applications (courier software) access these addresses.
But at the same time, there are old iOS and Android clients that did not have the ability to change the URL to connect to, and urls like domain.com/mod/index.php and domain.com/mod/mod/auth are statically wired in them .php
domain.com/index.php (for new ones) = domain.com/mod/index.php (for old ones)
domain.com/mod/auth.php (for new ones) = domain.com/mod/mod/auth .php (for old)
The task is as follows, you need to somehow implement it on the server so that URLs are available for all old and new clients:
domain.com/index.php
domain.com/mod/auth.php
domain.com/mod/index.php
domain.com/mod/mod/auth.php
Well, in fact, old and new should knock on different paths, but in the same folder.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Chistyakov, 2014-10-03
@alexclear

...
  location / {
    rewrite ^/mod/index.php$ /index.php;
    rewrite ^/mod/mod/auth.php$ /mod/auth.php;
    (остальная часть конфига)
  }
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question