1

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?

sparanoid
  • 205
  • 3
  • 7

2 Answers2

3

rewrite ^/feed$ /feed/ permanent;

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

Alex
  • 7,939
  • 6
  • 38
  • 52
0

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;
alvosu
  • 8,437
  • 25
  • 22