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

I have several Redirect directives in my Ubuntu /etc/apache2/sites-available file:

    Redirect 301 /rss.xml
    Redirect 301 /atom.xml
    Redirect 301 /feed/
    Redirect 301 /feed

They all work correctly, so far as I can tell.

However, when I visit with, it returns a 301 pointing at, which then gets redirected to, and so forth.

It seems that one of the patterns is matching when I don't expect it to. If I omit the last two redirects, the looping is stopped, but then I'm not redirecting /feed and /feed/ when I should.

Any ideas of how make this work correctly?

(I think the problem is related to this question:

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Redirect is simple prefix matching and "[a]dditional path information beyond the matched URL-Path will be appended to the target URL."

Thus /feed/index.xml matches your third rule /feed/ with additional path information index.xml so it gets redirected to /feed/index.xml with index.xml appended to it.

The solution is to use RedirectMatch and use anchors:

RedirectMatch 301 ^/rss.xml$
RedirectMatch 301 ^/atom.xml$
RedirectMatch 301 ^/feed/$
RedirectMatch 301 ^/feed$
share|improve this answer
Thank you, sir or madam! That did the trick. I don't know why I found that so difficult-- it's clearly in the docs here: – pingswept Sep 30 '10 at 19:06

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.