S
S
sailorpapay2020-08-26 17:14:55
Nginx
sailorpapay, 2020-08-26 17:14:55

What do these redirects mean in Nginx?

Help define what each rewrite/redirect means.

rewrite ^/(.*)/$ /$1 permanent;

if ($request_uri ~* "\/\/") {       rewrite ^/(.*)      $scheme://$host/$1    permanent;     }


rewrite ^/(.*)\.html /$1/ permanent;

if ($request_uri ~* "^(.*/)index\.php$") {
    return 301 $1;
}


if ($request_uri ~* "^(.*/)index\.php(/?)(.*)") {
        return 301 $1$3;
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2020-08-26
@yarkov

So here it is in detail. We must try to understand how it works, and not stupidly memorize.
ngx_http_rewrite_module
$request_uri

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question