I'm using Nginx and in my .conf file I have added a rewrite to remove all trailing slashes on the urls
rewrite ^/(.*)/$ /$1 permanent;
This works perfectly except for the /blog folder which enters into an infinite loop.
As I understand it it is because the /blog folder is a directory and all directories automatically add a trailing slash e.g. /blog/
Is there a way I can disable the trailing slash on directories in Nginx?
Many thanks!