301 redirect with custom content problem

Robert Mueller robm at fastmail.fm
Tue Dec 4 05:29:25 UTC 2012


> This way you'll end up with two 301 redirects due to rewrite being 
> executed again for /foo/bar/301.html.

Ah right, makes sense.

> Try this instead:
> 
>     server {
>         listen 80 default;
> 
>         location / {
>             error_page 301 /foo/bar/301.html;
>             return 301 "https://example.com$request_uri";
>         }
>                
>         location = /foo/bar/301.html {
>             # static
>         }
>     }

Great, that worked, thanks.

Rob



More information about the nginx mailing list