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 am curently using nginx and I am trying to redirect all request on to

I've browse some sites but I am too rookie with rewrite to obtain a nice result, could you please gimme me some help?

PS: This is what I've tried for last:

location = /world {
  rewrite ^$uri permanent;

Kind Regards,


share|improve this question

Try it like this:

location /world/ {
rewrite ^/(.*)$$1 break;

The nginx rewrite syntax is like:

rewrite regexp replacement [flag]

For more info, take a look at here. And also do some research about Regular Expressions. ;)

share|improve this answer

Don't have to use any location, just write the below rewrite directly within server.

    rewrite  ^/$  permanent;      
share|improve this answer
This rewrite looks good but when I applied it I have in my- navigator Erreur 310 (net::ERR_TOO_MANY_REDIRECTS) : Trop de redirections – Half Jan 4 '13 at 10:00
I guess it should be "^/$" instead of just "/", since the first param is a regexp. – cnst Jan 4 '13 at 18:20

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.