KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using magic URLs with command SEND HTML FILE
PRODUCT: 4D | VERSION: 2003.2 | PLATFORM: Mac & Win
Published On: February 26, 2004

4D web server will allow the use of so-called magic URLs that enable one to handle dynamic redirection through the On Web Connection and On Web Authentication database methods.

SEND HTML FILE will always use the Root directory set in web settings to refer to documents. For example: if you have your root directory set to C:\WebFolder
SEND HTML FILE("myfile.html") will point to C:\WebFolder\myfile.html

However, when SEND HTML FILE analyzes the content within the HTML file (img, href, etc.) it will refer to files relative to the directory contained in the HTTP Header X-URL.

If you pass a magic URL of 4DCGI/Test and pick it up in the On Web Connection method to redirect with
SEND HTML FILE("myfile.html"), 4D will send the file myfile.html contained in your web root directory, RootDirectory, and will analyze the content using references relative to /RootDirectory/4DCGI/.

So, a tag like <img src="images/myimage.gif"> will point to the image /RootDirectory/4DCGI/images/myimage.gif instead of /RootDirectory/images/myimage.gif