简体   繁体   中英

nginx remove extra trailing slash ate the end of URL

I have this configuration inside server block which redirects all http requests to the https server with a 301, moved permanently status.

The problem is that in Screaming Frog or Chrome I can see that http://kida.al is redirected to https://kida.al// and then to https://kida.al/ .

How can I prevent such a thing?

Thanks!

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    server_name kida.al;

    return      301 https://$server_name$request_uri/;
}

在此处输入图片说明

您应该从重定向路径的末尾删除多余的斜杠:

return 301 https://$server_name$request_uri;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM