PHP Settings => Main Settings and ticking Enable custom router handler in HEScript (OnRouterURL event).
If you do not need redirection, leave this feature off because it can slightly.increase the internal server's processing time.
Once the redirection support is enabled, for each request made to the server, an HEScript event named OnRouterURL available in the UserMain script will be invoked.
If you take a look at the UserMain script below:
function OnRouterURL(RequestedURL, RequestedFilename, PathInfo, QueryString: String): String;
The following parameters are passed:
RequestedURLcontains the full request URL.
RequestedFilenamerepresents the virtual path to the requested file.
PathInforepresents the value of PATH_INFO variable as defined for PHP. That is any client-provided pathname information trailing the actual script filename but preceding the query string, if available.
QueryStringcontains the query string, if any (text after ? in URL).
The engine will perform a redirection only if
Result is set to the new URL. For no redirection, just return an empty string.
The router script (which is also the homepage) is
public\index.php. The framework we use in this sample generates some URLs like
http://heserver/public/index.php/assets/image.png. Of course, the Chromium engine cannot find these URLs, so we rewrite them:
function OnRouterURL(RequestedURL, RequestedFilename, PathInfo, QueryString: String): String; begin // Lets you reroute any URL. if (RequestedFilename = "public\index.php") and (ExtractFileExt(PathInfo) <> "") then begin Result:="http://heserver/public" + PathInfo; exit; end; // Set Result to an empty string for no redirection. // Set Result to the new URL if you want a permanent redirection. Result := ""; end;