Skip to main content
Version: Next

WEB SEND HTTP REDIRECT

WEB SEND HTTP REDIRECT ( url {; *} )

ParameterTypeDescription
urlTextNew URL
*OperatorIf specified = URL is not translated, If omitted = URL is translated

Description

The WEB SEND HTTP REDIRECT command allows you to transform a URL into another one.

The url parameter contains the new URL that allows you to redirect the request. If this parameter is a url to a file, it must contain the reference to this file, for example: WEB SEND HTTP REDIRECT ("/MyPage.HTM").

This command prevails over commands that send data (WEB SEND FILE, WEB SEND BLOB, etc.) that may be in the same method.

This command also allows you to redirect a request to another Web server.

4D automatically encodes the URL’s special characters. If you pass the * character, 4D will not translate them.

Note that the status of the request sent by this command is 302: Moved Temporarily. If you need a "moved permanently" status (status 301), you can set a HTTP X-STATUS: 301 field in the header of the reply.

Example

 
var $targetURL : Text
$targetURL := "https://www.example.com"

WEB SEND HTTP REDIRECT($targetURL)

Properties

Command number659
Thread safe