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

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

1 Answer 1

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.