0

I have page with pagination which google marked as duplicate content, basically I have this page /asl/candidates/ and /asl/candidates/?page=1 is the same page. What I want to do is to 301 redirect /asl/candidates/?page=1 to /asl/candidates/

I tried

location = /asl/candidates/?page=1{
  return 301 /asl/candidates/;
}

But it seems it does not work with query strings.

1 Answer 1

1

Use $args or $arg_name if you need to get the argument(s) in the request line.

For example:

if ($args ~ "page=1") {
    rewrite ^/asl/candidates/$ /asl/candidates/? permanent;
}

Source: http://nginx.org/en/docs/http/ngx_http_core_module.html#variables

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.