Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.