Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [afinlr] Current URL

Quote Reply
Re: [afinlr] Current URL In reply to
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.
Subject Author Views Date
Thread Current URL afinlr 6432 Apr 5, 2004, 5:19 PM
Thread Re: [afinlr] Current URL
Andy 6367 Apr 6, 2004, 12:15 AM
Thread Re: [Andy] Current URL
afinlr 6280 Apr 6, 2004, 4:14 AM
Thread Re: [afinlr] Current URL
KevM 6284 Apr 6, 2004, 6:59 AM
Thread Re: [KevM] Current URL
afinlr 6261 Apr 6, 2004, 7:48 AM
Thread Re: [afinlr] Current URL
KevM 6271 Apr 6, 2004, 8:21 AM
Post Re: [KevM] Current URL
afinlr 6258 Apr 6, 2004, 8:24 AM
Thread Re: [KevM] Current URL
afinlr 6270 Apr 6, 2004, 8:28 AM
Thread Re: [afinlr] Current URL
KevM 6246 Apr 6, 2004, 8:35 AM
Post Re: [KevM] Current URL
afinlr 6260 Apr 6, 2004, 8:58 AM
Thread Re: [afinlr] Current URL
pugdog 6233 Apr 6, 2004, 10:32 AM
Thread Re: [pugdog] Current URL
afinlr 6248 Apr 6, 2004, 12:09 PM
Thread Re: [afinlr] Current URL
pugdog 6210 Apr 6, 2004, 3:35 PM
Thread Re: [pugdog] Current URL
afinlr 6218 Apr 6, 2004, 3:39 PM
Thread Re: [afinlr] Current URL
pugdog 6201 Apr 7, 2004, 3:19 PM
Thread Re: [pugdog] Current URL
afinlr 6201 Apr 7, 2004, 3:35 PM
Thread Re: [afinlr] Current URL
mick31 6086 Dec 23, 2004, 6:22 AM
Post Re: [mick31] Current URL
afinlr 6067 Dec 24, 2004, 9:10 AM