Forum Moderators: coopster & phranque

Message Too Old, No Replies

what page is my visitor on (CGI variable?)

When my script is activated, I'd like it to know what the page URL is ...

         

jcmoon

10:05 pm on Aug 23, 2006 (gmt 0)

10+ Year Member



I've got a pretty good idea how CGI environment variables work, and what I can get from them. But my pages are all mod_rewritten using .htaccess, so it seems all I can get is the script URL the visitor is accessing (i.e. /cgi-bin/script.cgi?var1=value1&var2=value2).

I want my script to find out what specific page the user has loaded. Aside from adding a &url= field in all of my .htaccess rules and recreating the URL within the rule from there, how can I accomplish this?

Is there a CGI environment variable for the path & filename, before it was mod_rewritten?

rocknbil

8:15 pm on Aug 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you try $ENV{REQUEST_URI}?

I'm using mod_rewrite also and get the requested URI /Some_Name, which rewrites to somescript.cgi?some=ugly&query=string, are you doing mod_rewrite backwards?

jcmoon

9:12 pm on Aug 24, 2006 (gmt 0)

10+ Year Member



Oh wow, yes. And I admit, I was about to start doing the "reverse" mod-rewrite, appending the URL pattern at the end of the?some=ugly&query=string&url=long-$1-url_$2_pattern

now, I needn't do that anymore. You have just made my job, much simpler. Thanks!