Browse Source

Добавить 'includes.d/to-slash-redirect.conf'

master
gitea 4 years ago
parent
commit
46d16ac4c0
  1. 17
      includes.d/to-slash-redirect.conf

17
includes.d/to-slash-redirect.conf

@ -0,0 +1,17 @@
error_page 419 = @redirectoToSlash;
set $is_admin_area "0";
if ( $request_uri ~* ^/admin.*$ ) {
set $is_admin_area "${is_admin_area}1";
}
if ( $request_uri ~* ^.*ajax.*$ ) {
set $is_admin_area "${is_admin_area}1";
}
if ( $request_uri ~* ^[^\?\.]*[^/](|\?.*)$) {
set $is_admin_area "${is_admin_area}0";
}
if ( $is_admin_area = "00" ) {
return 419;
}
location @redirectoToSlash {
rewrite ^(.*[^/])$ $1/ permanent;
}
Loading…
Cancel
Save