是否可以通过python cgi脚本发送200以外的状态代码(例如301重定向)
答案 0 :(得分:20)
通过cgi脚本?
print "Status:301\nLocation: http://www.google.com"
答案 1 :(得分:0)
通过wsgi应用程序?
def simple_app(environ, start_response):
status = '301 Moved Permanently' # HTTP Status
headers = [('Location','http://example.com')] # HTTP Headers
start_response(status, headers)
return []