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

We had a "beta" site set up under, while contained a launch page. We now got rid of the launch page and moved the site over to the actual domain. I set up a permanent redirect in nginx to deal with this, but it somehow is not redirecting properly.

server {

    rewrite ^/(.*)$1 permanent;


When I test it out using curl, it seems to work as expected.

$ curl -v
> GET /page HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host:
> Accept: */*
< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.2.1
< Date: Tue, 16 Jul 2013 20:37:03 GMT
< Content-Type: text/html
< Content-Length: 184
< Connection: keep-alive
< Location:
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>

However, when I go to in Firefox, I get redirected to instead of If I go directly to in Firefox, that works as expected.

I want to fix this with proper permanent redirect for SEO, but can't figure out the cause of this issue. We are using a Python/Django deployment running on Apache/ModWSGI, with nginx as the frontend server.


share|improve this question

Try using return instead.

server {
    listen [::]:80;
    return 301 $scheme://$request_uri$is_args$args;
share|improve this answer

Comparing with some rewrites on my server you may have a some unneeded slashes

try rewrite ^(.*) scheme://$1 permanent;

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.