如何在CGIAr中使用Python重定向到另一个页面 [英] How to redirect to another page in Python in CGIAr

查看:69
本文介绍了如何在CGIAr中使用Python重定向到另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想使用以下核心库将用户从cgi脚本重定向到HTML页面:

import cgi

请有人指出正确的方向。而已。只需将cgi脚本重定向到html页面即可。您将如何使用此Python。如果您必须亲自写出HTTP响应标头以实现此目的,那么我将不胜感激有关如何执行此操作的任何信息。
TIA

Please could someone point me in the right direction. Nothing more. Simply redirect from cgi script to html page. How ever you would do this Python. If you have to physically write out the HTTP Response Headers to achieve this, then I would appreciate any info on how to do this. TIA

Andrew

推荐答案

您需要输出除了 Location 之外还有一个标题(状态),例如:

You need to output one more header ("Status") in addition to the Location one, e.g.:

print "Status: 301 Moved",
print "Location:/wherever.com/"

这篇关于如何在CGIAr中使用Python重定向到另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆