Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using nginx with the following rewrite:

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

When I try to access:

http://domain/feed/

I works great. But when I access:

http://domain/feed

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

2 Answers 2

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;

or:

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

Your Answer

 
discard

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.