1

Domain is no longer in use, and I need to make redirects to correct website, but only for specific urls.

server {
    listen 80;

    server_name example.org;

    location ~ ^/(page|show) {
        return 301 http://new-domain.org/$request_uri;
    }

    location = / {
        return 301 http://new-domain.org/;
    }

    return 410;
}

Only main page and urls matching the pattern will be redirected, everything else should throw 410 HTTP code

but config above is not working, currently everything is throwing 410...

0

1 Answer 1

3

Try putting it in a location. Anything in the server block will always match.

location / {
    return 410;
}

You must log in to answer this question.