Did you print out the full values of the $ENV hash your server has?
There are some DOCUMENT values that some servers are returning now, that give the URL of the document.
The problem is that if the request is rewritten, the location that stores the value may be rewritten.
The only thing I could envision, at that point, if the $ENV string is not kept, then is to grab the URL before it's rewritten, and pass it as a parameter.
RewriteRule (.*) /cgi-bin/LinkSQL/page.cgi?g=$1
Will put the value of the URL into the $1 variable.
Adding [E=
ORIGINAL_URL:$1] will write out a new $ENV variable ORIGINAL_URL with the value of $1
According to the mod_rewrite docs
Quote:
Environment Variables[/url]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.,
before any rewriting. This is important because the rewriting process is primarily used to rewrite logical URLs to physical pathnames.
Example: SCRIPT_NAME=/sw/lib/w3s/tree/global/u/rse/.www/index.html SCRIPT_FILENAME=/u/rse/.www/index.html SCRIPT_URL=/u/rse/ SCRIPT_URI=http://en1.engelschall.com/u/rse/
An explanation of available flags (brief)
Quote:
Rewrite Rule
Syntax: RewriteRule
url-pattern url-new [[
flag,...]]
Example: RewriteRule ^/foo/(.*)$ /bar/$1 [R,L]
Since: Apache 1.2
This directive is the real rewriting workhorse. It can occur more than once. Each directive then defines a single rewriting rule. The definition order of these rules is important, because it is used when applying the rules at runtime. The
url-pattern is a regular expression that is applied to the current URL, where ``current'' means at the time when this rule is applied. The current URL may not be the original requested URL, because any number of rules could have already matched and altered it.
The
url-new argument is the string that is substituted for the original URL matched by the
url-pattern. Beside plain text, you can use back-references ($
N) to the
url-pattern, back- references (%
N) to the last matched
RewriteCond pattern, server variables such as
RewriteCond test strings (%{
NAME}), and mapping function calls (${
map-name:
look==up-key|
default-value}) for this argument.
In addition, you can set special flags for
url-new by appending one or more
flag arguments. The flag argument is actually a comma-separated list of the following flags: redirect (or R) to force an HTTP redirect; forbidden (or F) to forbid access; gone (or G) to eliminate the URL; proxy (or P) to pass the URL to
mod_proxy; last (or L) to stop processing; next (or N) to start the next round of processing; chain (or C) to chain the current rule with the following one; type (or T) to force a particular MIME type; nosubreq (or NS) to ensure that the rule applies only if no internal sub-request is performed; nocase (or NC) to force the URL matching to be case-insensitive; qsappend (or QSA) to append a query string part in
url-new to the existing one instead of replacing it; passthrough (or PT) to pass the rewritten URL through to other Apache modules; skip (or S) to skip the next rule; and env (or E) to set an environment variable. For more details, see the
mod_rewrite online documentation.
PUGDOG� Enterprises, Inc. The best way to contact me is to
NOT use Email.
Please leave a PM here.