Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CGI and Redirect

9 views
Skip to first unread message

Grzegorz Ślusarek

unread,
Feb 21, 2006, 8:38:34 AM2/21/06
to
Hi All. I need to redirect user in my CGI script, i Try to use prin
"Location: "+url but this is not working. Can anyone tell me what I'm
doing wrong?
Any thanks will be apreciated
Gregor

Gerhard Häring

unread,
Feb 21, 2006, 8:59:18 AM2/21/06
to pytho...@python.org

I guess you forgot to set the HTTP-Status. Either:

print "Status: 301" # Moved Permanently

or

print "Status: 302" # Moved Temporarily

HTH,

-- Gerhard

Fredrik Lundh

unread,
Feb 21, 2006, 9:07:16 AM2/21/06
to pytho...@python.org
Grzegorz Slusarek wrote:

> Hi All. I need to redirect user in my CGI script, i Try to use prin
> "Location: "+url but this is not working. Can anyone tell me what I'm
> doing wrong?

something like

print "Status: 302"
print "Location: " + new_url
print
sys.exit(1)

should work (assuming that sys is imported, of course)

(if it doesn't, you have to define "not working")

hope this helps!

</F>

0 new messages