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 want to append a string to every request that refers to the root.

eg) ->

I wrote the conf as below, but the brower said there are cyclic redirections:

            if ($host ~ '$') {
                    rewrite ^/(.*)$ permanent;

How to write this?

share|improve this question

You need to do this

 if ($host ~ '$') {
                    rewrite ^/$ permanent;
share|improve this answer
I think location = / {} is better. – SaveTheRbtz Jan 13 '12 at 21:22

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.