4D v14.3

WEB SEND HTTP REDIRECT

Home

 
4D v14.3
WEB SEND HTTP REDIRECT

WEB SEND HTTP REDIRECT 


 

WEB SEND HTTP REDIRECT ( path {; *} ) 
Parameter Type   Description
path  String in New URL
Operator in If specified = URL is not translated, If omitted = URL is translated

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  

You can use this command to execute custom requests in 4D by using static pages. Imagine that you have placed the following elements in a static HTML page:

Note: The POST action “/4dcgi/rech” has been associated to the text area and to the OK and Cancel buttons.

In the On Web Connection Database Method, you insert the following code:

 Case of
    :($1="/4dcgi/rech") //When 4D receives this URL
  //If the OK button has been used and the ‘name’ field contains a Value
       If((bOK="OK") & (name#""))
  //Change the URL to execute the request code,
  //placed farther down in the same method
          WEB SEND HTTP REDIRECT("/4dcgi/rech?"+name)
       Else
  //Else return to the beginning page
          WEB SEND HTTP REDIRECT("/page1.htm")
       End if
       ...
    :($1="/4dcgi/rech?@") //If the URL has been redirected
       ... //Put the request code here
 End case

 
PROPERTIES 

Product: 4D
Theme: Web Server
Number: 659

 
HISTORY 

Created: 4D v6.5
Renamed: 4D v13

 
ARTICLE USAGE

4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)

Inherited from : SEND HTTP REDIRECT ( 4D v12.4)