如何用Python实现简单的HTTP重定向?

6 投票
1 回答
15928 浏览
提问于 2025-04-16 13:47

如何用Python做简单的HTTP重定向?不使用meta标签

更新:

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

1 个回答

6

要在你现在的设置下(CGI apache)进行重定向:

print("Location:http://newurl.com/foobar")
print # to end the CGI response headers.

撰写回答