Gossamer Forum
Home : General : Perl Programming :

Redirection Error

Quote Reply
Redirection Error
Hi,

I am trying to redirect using perl. I use the code:
Code:
print "Location: http://www.some-where.com\n\n";
When I run the script, instead of redirecting to the url it posts Location: http://www.some-where.com. Can someone please help me.

-Matt
Quote Reply
Re: Redirection Error In reply to
try:
Code:
print "Location: http:/www.some-where.com\n\n" :

------------------
Quote Reply
Re: Redirection Error In reply to
Hi Matt,

Your code is right anyway. I'm guessing you mean it prints:

Location: http://www.some-where.com\n\n

to the browser. If this is so, the problem is that you've already printed the Content-type header, so the script thinks you actually want to print it, rather than send the header. You have to do one or the other.

If you can't figure it out, copy your script to a text file in a web accesible directory and I'll take a look at it for you...

adam
Quote Reply
Re: Redirection Error In reply to
Thanks dahamsta,
The Content-type header was before the redirect command.

-Matt
Quote Reply
Re: Redirection Error In reply to
Same question, just a bit different setting:
I already have Content type html set at the top of my script because in this big script most of the output should be in HTML. By setting it once at the top save me from setting it over and over again everytime I want to print HTML.
However, on one or two other instance , I would like to redirect the users to a location. Is there anyway to :
"de"-Content-type-html? Is there any code that would strip off the effect of the Content type so the code "Location: " would work?

Thank you in advance!
Quote Reply
Re: Redirection Error In reply to
Hi Hieu,

Fraid not, once you've printed it, your stuck.

Cheers,

Alex