getRedirectCode()

Returns the HTTP redirect code used when getRedirect() is set to true for the PageReference object.

Signature

public Integer getRedirectCode()

Return Value

Type: Integer

Possible Values:
  • 0 — Redirect using the default redirect action for this PageReference. Typically a JavaScript-based redirection or HTTP 302.

    Site URLRewriter Interface implementations pointing to a PageReference with a redirectCode of 0 are not redirected.

    Note

  • 301 — Moved Permanently. Redirect users by sending an HTTP GET request to the target location. Includes instructions to update any references to the requested URL with the target location.
  • 302 — Moved Temporarily. Redirect users by sending an HTTP GET request to the target location. Because the redirection is temporary, it doesn’t include update instructions.
  • 303 — See Other. Redirect users by sending an HTTP GET request to the target location. Not commonly used. Useful when the client sends a POST request and you want the client to call the new web page using a GET request instead of a POST request.
  • 307 — Temporary Redirect. Send the same HTTP request, regardless of the HTTP method, to the target location. Because the redirection is temporary, it doesn’t include update instructions.
  • 308 — Permanent Redirect. Send the same HTTP request, regardless of the HTTP method, to the target location. Includes instructions to update any references to the requested URL with the target location.