I am using the below regex to add a trailing slash to any url that doesn't have a railing slash or ends ends with ..

rewrite ^([^.]*[^/])$ $1/ permanent;

This works fine for http, but when I use https it doesn't. I can't work out why? Can you?

  • Enable rewrite_log in Nginx and see why it doesn't work! Oct 25 '13 at 2:31
  • @Pothi Already, it just says it doesn't match. Which is odd, because it does. Oct 25 '13 at 2:41
  • Odd indeed. Please try if ($uri !~* "/$") { return 301 $scheme://domainname.tld$uri/; } instead of the rewrites. Oct 25 '13 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.