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'm trying to setup a friendly URL for a website running on my Nginx server but for some reason, the url's are being redirected instead of being rewritten.

For instance If a user visits I want to stay in the address bar, but for the content to be pulled from

In my Nginx site configuration I have the following (a simple example with some stuff chopped out for simplicities sake):

server {

    location / {
        rewrite ^/aboutus/$ permanent;


For whatever reason, Nginx seems to insist on redirecting the 'friendly' url to the php file, but I want a more traditional "rewrite" (like I've done before in Apache mod_rewrite without issue).

I'm probably doing something wrong, but I'll be damned if I can work out what.

share|improve this question
Did you read the documentation? – VBart Dec 3 '12 at 20:27

You're getting a 301 redirect because you specifically asked for a 301 redirect.

To fix the problem, use a relative destination URL, and last instead of permanent.

For example:

rewrite ^/aboutus/$ /aboutus.php last;
share|improve this answer

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.