Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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'm using nginx with the following rewrite:

rewrite ^/feed/?$ /index.xml last;

When I try to access:


I works great. But when I access:


It does not add the trailing slash. I'd like to add a trailing slash automatically when I access the link above, anyone know a solution to this?

share|improve this question
up vote 1 down vote accepted

rewrite ^/feed$ /feed/ permanent;

rewrite ^/feed/$ /index.xml last;

share|improve this answer
Great! Thank you. – sparanoid Feb 4 '11 at 4:13

Try(if not real server_name):

rewrite ^/feed$ http://$hostname/feed/ permanent;
rewrite ^/feed/?$ /index.xml last;


rewrite ^/feed$ /feed/ permanent;
rewrite ^/feed/?$ /index.xml last;
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.