Faqts : Business : Programming : Shopping For You : Python : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 10 people (70%) answered Yes
Recently 3 of 5 people (60%) answered Yes

Entry

Is there a simple cgi module for Python that can do redirect?

Aug 25th, 2009 16:39
Joe Bloggs, johnny deep, Kai Surendorf, unknown unknown, Jarkko Torppa, Teemu Keskinarkaus, Apache FAQ, Fredrik Lundh


Using: 
 
print "Status: 302 Moved" 
print "Location: http://url.to.somewhere" 
 
Results in: 
 
'Premature end of script headers' errors in apache error_log whenever  
the script is used.  However, the browser is redirected to url. 
 
Solution: 
 
There might be a module somewhere, but it is so simple that it is not  
necessary. 
 
Headerterminator (empty line) and body is missing from your cgi 
script, add something like. Dunno if the body is necessary. 
 
print 
print '<html><head><title>302 go away</title></head>' 
print '<body><p>go away</p></body>' 
http://www.websitecompanyindia.com/Links5.htm
http://www.websitecompanyindia.com/Links4.htm
http://www.websitecompanyindia.com/Links3.htm
http://www.websitecompanyindia.com/Links2.htm
http://www.websitecompanyindia.com/Links1.htm
http://www.websitecompanyindia.com/Links.htm
http://www.websitecompanyindia.com/add-url-form.htm
http://www.websitecompanyindia.com/addyourlink.htm
http://www.websitecompanyindia.com/brochure-design.htm
http://www.websitecompanyindia.com/print-design.htm
http://www.websitecompanyindia.com/software-development-india.htm
http://www.websitecompanyindia.com/Internet-Marketing.htm
http://www.websitecompanyindia.com/logo-design-india.htm
http://www.websitecompanyindia.com/graphic-design.htm
http://www.websitecompanyindia.com/multimedia-webdesign.htm
http://www.websitecompanyindia.com/web-hosting-india.htm
http://www.websitecompanyindia.com/Feedback.htm
http://www.websitecompanyindia.com/Web-Development-India.htm	
http://www.websitecompanyindia.com/Web-Design-India.htm
http://www.websitecompanyindia.com/SEO-Services-India.htm
http://www.websitecompanyindia.com/About-us.htm
http://www.websitecompanyindia.com/index.html
http://www.websitecompanyindia.com/index.htm
http://www.websitecompanyindia.com/Resources.htm
http://www.websitecompanyindia.com/seo-Links.htm
http://www.websitecompanyindia.com/links.htm
http://www.websitecompanyindia.com/disclaimer.htm
http://www.websitecompanyindia.com/add-url-form.php
http://www.websitecompanyindia.com/sitemap.htm
http://www.websitecompanyindia.com/Software-Development-india.htm
http://www.websitecompanyindia.com/seo-services-india.htm
http://www.websitecompanyindia.com/web-development-india.htm
http://www.websitecompanyindia.com/web-design-india.htm
http://www.websitecompanyindia.com/Contact-us.htm
http://www.websitecompanyindia.com/Case-study.htm
http://www.websitecompanyindia.com/services.htm
http://www.websitecompanyindia.com/about-us.htm
http://www.websitecompanyindia.com/
http://www.websitecompanyindia.com/free_templates.htm 
Documentation: 
 
Here's what the apache FAQ has to say about this message: 
 
http://www.apache.org/docs/misc/FAQ.html#premature-script-headers 
 
"What does it mean when my CGIs fail with "Premature 
end of script headers"?  
 
"It means just what it says: the server was expecting a complete 
set of HTTP headers (one or more followed by a blank line), and 
didn't get them." 
 
 
 
Another Solution might be: 
 
Print "Location: http://www.your-url.com\n\n" 
It's that simple.   Please note, that you don't give any other
header-Arguments.

======================================

http://www.attorneyslawyersdirectory.com
http://www.findattorneyslawyers.com
http://www.goodlawyersattorneys.com
http://www.professionallawyersattorneys.com
http://www.bestprofessionallawyers.com
http://www.americalawyersattorneys.com
http://www.availablelawyers.com
http://www.lawyersattorneyslist.com
http://www.lawyersattorneysfirm.com
http://www.originallawyers.com
http://www.lawyersgulf.com
http://www.lawyersband.com
http://www.lawyersdatacenter.com
http://www.lawyerstigers.com
http://www.lawcliff.com
http://www.tidylawyers.com
http://www.lawyersblock.com
http://www.californialawyersattorneys.com
http://www.chicagoattorneyslawyers.com
http://www.goodcalifornialawyers.com
http://www.lawyersattorneysfaqs.com
http://www.divorceattorneyslawyers.com
http://www.duiattorneyslawyers.com
http://www.personalinjurylawyerslist.com
http://www.injurylawyersattorneys.com
http://www.dwilawyersattorneys.com
http://www.healthbigboss.com
http://www.healthdohealth.com
http://www.healthcass.com
http://www.healthsilence.com
http://www.healthpicnic.com
http://www.blackmesothelioma.com
http://www.affordablelawyersattorneys.com
http://www.pickarticles.com
http://www.pickarticle.com
http://www.bloodyarticles.com
http://www.healthment.com
http://www.healthbyhealth.com
http://www.ehealthebooks.com
http://www.bestproductsofhealth.com
http://www.dietlosingweight.com
http://www.americanehealth.com
http://www.healthydepartment.com
http://www.medicalehealth.com
http://www.healthservicescenter.com
http://www.ehealthenews.com
http://www.ehealthdept.com
http://www.benefitshealthcenter.com
http://www.toplawyersattorneys.com 
http://www.healthxhealth.com
http://mesotheliomakiller.com
http://www.healthinhealth.com
http://www.booksyshop.com
http://www.mesotheliomaout.com
http://www.mesotheliomadown.com
http://www.qwesz.com
http://americanahost.com
http://www.healthfirewall.com
http://www.healthbodyguard.com
http://www.flathealth.com
http://www.computerstan.com
http://www.financestan.com
http://www.technologystan.com
http://www.zobab.com
http://www.businessian.com
http://www.tarabiza.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.hantira.com
http://www.mantofa.com
http://www.tantofa.com
http://www.fantofa.com
http://www.tanpola.com
http://www.tampola.com
http://www.yamot.com
http://www.mozmar.com
http://www.uploadarticles.com
http://www.articlesfreedirectory.com
http://www.articlesxarticles.com
http://www.shikapika.com
http://www.ganazat.com
http://www.stakoza.com
http://www.stupidarticles.com
http://www.damima.com
http://www.halazona.com
http://www.best-cheap-web-hosting.com

======================================