in reply to can't get value of $ENV{REDIRECT_URL}

You need to give a bit more information. What webserver are you running on which operating system?

When you answer that, you will usually find that the documentation for the webserver will tell you precisely which environment variables it passes into any scripts. It's also useful to have an "envdump.pl" script in your cgi-bin directory.

#!/usr/bin/perl -w use strict; use CGI qw(:standard); use Data::Dumper; print header, start_html('Environment vars'); print pre(Dumper(\%ENV)), end_html;
Hope this helps.

--
I'm Not Just Another Perl Hacker

Replies are listed 'Best First'.
Re: Re: can't get value of $ENV{REDIRECT_URL}
by Anonymous Monk on Dec 02, 2003 at 18:04 UTC
    thanks - I ran the dumper script and thesea re the values I get:
    $VAR1 = { 'QUERY_STRING' => '', 'HTTP_X_FORWARDED_FOR' => '81.78.90.129', 'SERVER_ADDR' => '212.67.202.134', 'HTTP_ACCEPT_LANGUAGE' => 'en-gb', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'HTTP_CONNECTION' => 'keep-alive', 'HTTP_ACCEPT' => 'image/gif, image/x-xbitmap, image/jpeg, im +age/pjpeg, */*', 'HTTP_USER_AGENT' => 'Mozilla/4.0 (compatible; MSIE 6.0; Win +dows NT 5.1; Alexa Toolbar)', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'HTTP_HOST' => 'www.photographersdirect.com', 'SERVER_SOFTWARE' => 'Apache/1.3.27 (Unix) (Red-Hat/Linux) +Chili!Soft-ASP/3.6.2 mod_ssl/2.8.14 OpenSSL/0.9.6b PHP/4.1.2 FrontPag +e/5.0.2.2510', 'SERVER_ADMIN' => 'webmaster@photographersdirect.com', 'REMOTE_ADDR' => '195.92.67.69', 'SCRIPT_NAME' => '/formmail/dumper.cgi', 'SERVER_NAME' => 'photographersdirect.com', 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 'DOCUMENT_ROOT' => '/home/picturesea/public_html', 'REQUEST_URI' => '/formmail/dumper.cgi', 'HTTP_VIA' => '1.1 webcacheH05 (NetCache NetApp/5.3.1R2)', 'REQUEST_METHOD' => 'GET', 'SCRIPT_FILENAME' => '/home/picturesea/public_html/formmail/ +dumper.cgi', 'PATH' => '/usr/local/bin:/usr/bin:/bin', 'SERVER_PORT' => '80' };
    I can't see anything here that shows the file it redirected from.

    Edit: BazB changed pre tags to code tags.

      $ENV{HTTP_REFERER} is used for that purpose, IIRC. Don't rely on it too much though, since it can be faked, or left out completely.

      Update: To be honest, I have never heard of anything like $ENV{REDIRECT...} variables with Apache :(

      --
      B10m