Trailing Slash Redirect Loop Help
francis at daoine.org
Sat Apr 29 12:35:16 UTC 2017
On Fri, Apr 28, 2017 at 10:27:12AM -0400, Alex Med wrote:
> I am having an issue getting rid of the trailing slashes for directories. I
> have used the following to get rid off the trailing slash:
Why do you want to get rid of the trailing slash for directories?
You can do it; but you will probably have to write the code to tell your
web server how to handle the request, because the common case is that
the slash is wanted.
So - you can make a request for /file/; nginx can issue a redirect to
/file; you can make a request for /file; and nginx can serve the content
of /usr/local/nginx/html/file. All good.
Next - you make a request for /dir/; nginx can issue a redirect to /dir;
you can make a request for /dir; what do you want to happen next? The
nginx-is-serving-this-from-the-filesystem behaviour is for nginx to issue
a redirect to /dir/. If you want something else to happen, you must
decide what that something else is, and then arrange that it happens,
possibly by config and possibly by coding.
Good luck with it,
Francis Daly francis at daoine.org
More information about the nginx