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;
}