The CResponse::redirect function adds an HTTP header to the response.

int redirect(
chchar * URL // points to a string containing the URL

Return Type

Upon successful completion, zero is returned. Otherwise, a value of non-zero is returned.


A string containing the URL.


This function stops the server from processing the current script and then causes the browser to attempt to connect to a different URL.

If you have set any response body content in the page, it will be ignored. However, this function does send to the client other HTTP headers set by this page. An automatic response body containing the redirect URL as a link is generated. This function sends the following explicit header,
    HTTP 1.0 302 Object Moved
    Location: URL
where URL is the value passed to the function.

If buffering is set to false and your component attempts to call this function after any body has been sent to the client, the server will generate an error.

See Also

CResponse, CResponse::getStatus