Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: •Re: cgi redirect

by The_Rev (Acolyte)
on Nov 26, 2002 at 19:44 UTC ( [id://215911]=note: print w/replies, xml ) Need Help??


in reply to •Re: cgi redirect
in thread cgi redirect

That does indeed work, but the URL for the specific page is still displayed in the path on the browser...Is it possible to use an internal redirect without the URL changing to the user

Replies are listed 'Best First'.
Re: cgi redirect
by cLive ;-) (Prior) on Nov 26, 2002 at 20:12 UTC
    Poor man's solution:
    #!/usr/bin/perl use strict; use warnings; use LWP::Simple my $url = 'http://some.domain/some/path/to/file.htm'; my $content = get $url; $content =~ s|</head>|<base href="$url"></head>|is; print "Content-type: text/html\n\n$content"; exit(0);

    If you want to keep all links internal, it will take a while - especially if you take some time to think about why you want to mis-represent content's origin to users on that large a scale.

    .02

    cLive ;-)

•Re: Re: •Re: cgi redirect
by merlyn (Sage) on Nov 27, 2002 at 00:51 UTC
    That does indeed work, but the URL for the specific page is still displayed in the path on the browser
    I'm not sure what you mean. If you put:
    print "Location: /icons/left.gif\n\n";
    at /cgi/leftarrow, it'll run the script and display a left arrow, but the URL will still remain the CGI location. I thought that's what you wanted.

    Actually, you may be running a non-standard web server (something other than Apache). If that's the case, you should disclose that so I stop trying to bring Apache-specific knowledge into the discussion.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

      Sorry Merlyn, for the long delay in my response. I am using apache, and I do need to hide the url path displayed in the browser from the user.

      I'm a little unclear as to what you mean with :

      at /cgi/leftarrow, it'll run the script and display a left arrow, but +the URL will still remain the CGI location.
      Thanks
Re: cgi redirect
by crenz (Priest) on Nov 26, 2002 at 20:13 UTC

    I'm not aware how to do this with a CGI-Script. It might be possible with mod_perl, though.

    Take a look at the Apache module mod_rewrite; that should do what you want.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://215911]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2025-06-19 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.