Gossamer Forum
Home : General : Perl Programming :

Location:

Quote Reply
Location:
Location: /dir/filename.html vs Location: http://www.domain.com/dir/filename.html

Hi,

When I call my script /redirect.cgi?file=test and I use location without a domainname it seems like the /redirect.cgi?file=test is the actual url, while when I use location with a domainname the script will actually do a redirect.

Is this a feature or a bug? Because I would like to keep /redirect.cgi?file=test always as the url. But i'm not sure if this only happens with my browser.

(why? I don't want to 'give away' the directoryname!)

Quote Reply
Re: Location: In reply to
How about

$url = param('file');

print "Location: http://www.myurl.com$url\n";


Then you would just use something like:

/redirect.cgi?file=/test/index.html

This would take you to...

http://www.myurl.com/test/index.html

Paul Wilson.
http://www.wiredon.net/gt/
http://www.perlmad.com/
Quote Reply
Re: Location: In reply to
I know,

but as i (tried to) explain in my post: I would like to do a hidden redirect. So the user would still see the orginal scriptlocation in his url-bar.

Please read the post above!

Quote Reply
Re: Location: In reply to
In Reply To:
but as i (tried to) explain in my post: I would like to do a hidden redirect.
I assumed you meant you didn't want the URL yo be visible in the query string.

In Reply To:
Is this a feature or a bug?
A feature or bug of what?

You want to *cloak* the URL?

Paul Wilson.
http://www.wiredon.net/gt/
http://www.perlmad.com/
Quote Reply
Re: Location: In reply to
In reference to my post above I would like to serve the following html-page:

http://www.domain.com/dir/subdir/subdir/filename.html

BUT ALWAYS show : /scriptname.cgi?file=filename

(Don't worry about changing filename into /dir/sub...../.../html!)

Is this called cloaking?

Quote Reply
Re: Location: In reply to
You don't want a redirect then, because the url redirected to will always show. YOu want to call your scriptname.cgi?file=test and have scriptname.cgi open the file on the server on send the html to the browser.

If it's on a different server, then you want to use LWP to get the page and then print out the contents.

Installation support is provided via ICQ at UIN# 53788453. I will only respond on that number.
Quote Reply
Re: Location: In reply to
But howcome when i use Location: /dir/filename.html in my script /redirect.cgi the urlbar will display redirect.cgi and NOT the actual url.

But when I use http://domain.com/dir/filename.html the urlbar will show http://domain.com/dir/filename.html instead of redirect.cgi!