Redirect (open)

Redirect the user to a page

Syntax

LOADLIB "mod::system/lib/webserver.whlib";

MACRO Redirect(STRING url, INTEGER redirectcode)

Parameters

STRING url

The URL of the page to redirect the user to. Instead of a URL a relative path may also be used.

INTEGER redirectcode

Redirect code to use (303 = Temporary redirect, 301 = Permanent redirect). Defaults to 303.

Description

Reset the response and redirect the user to the specified page. This function does not return.

Examples

// A redirect to a specified URL, including a parameter
STRING param := EncodeURL( GetWebVariable("searchstring") );
Redirect("http://www.searchengine.com/index.shtml?search=" || param);

// A redirect to a relative path
Redirect("../../document.doc/index.html");

// A Redirect to the root of the site
Redirect("/");

// Redirect to the current page, deleting all parameters from the url (if any)
// and adding parameter 'step=2'
Redirect("?step=2")