如何使用Python进行简单的http重定向?

Bab*_*ker 5 python redirect header http

如何使用Python进行简单的http重定向?不使用元.

更新:

我在Apache的cgi-bin目录中使用Python 2.7.1作为CGI.

Mik*_*wis 5

要使用当前设置重定向(CGI apache):

print("Location:http://newurl.com/foobar")
print # to end the CGI response headers.
Run Code Online (Sandbox Code Playgroud)