![]()
Special Features
Environment Variables
This module keeps track of two additional (non-standard) CGI/SSI environment variables named SCRIPT_URL and SCRIPT_URI. These contain the logical Web-view to the current resource, while the standard CGI/SSI variables SCRIPT_NAME and SCRIPT_FILENAME contain the physical System-view.Notice: These variables hold the URI/URL as they were initially requested, i.e. in a state before any rewriting. This is important because the rewriting process is primarily used to rewrite logical URLs to physical pathnames.
Example:
SCRIPT_NAME=/v/sw/free/lib/apache/global/u/rse/.www/index.html SCRIPT_FILENAME=/u/rse/.www/index.html SCRIPT_URL=/u/rse/ SCRIPT_URI=http://en2.en.sdm.de/u/rse/Two practical uses:
- Creation of generic SSI-footers containing a reference about the URI of the current page:
: <ht> <center> URI: <--#echo var="SCRIPT_URI"--> </center> :
- Creation of absolute references to a relative file, e.g. for the use with the Refresh:-header where a new file is loaded after a period of time. In this example the new file has to be referenced by an absolute URL (i.e. an URI). Here is a way to do it [by the help of embedded Perl for HTML (ePerl), which can be obtained from http://www.engelschall.com/sw/eperl/]:
<!DOCTYPE html PUBLIC '-//IETF//DTD HTML 2.0//EN'> <META HTTP-EQUIV="Refresh" CONTENT="4; URL=<? $URI = $ENV{'SCRIPT_URI'}; $URI =~ s|[^/]+$||; $URI .= "other-rel-doc.html"; print $URI; !>" > <html> :