title: Python Redirect not working
body: <p>I'm trying to redirect the user to my homepage. Its suppose to be as simple as </p>
  
  <pre><code>print "Location:http://localhost:8000/index.html"
  print ""
  </code></pre>
  
  <p>This isn't working for some reason. I'm running CGIHTTPServer on Kali Linux. I'm using Python 2.7.3
  When I try to run the script it simply prints out </p>
  
  <pre><code>Location:http://localhost:8000/index.html
  </code></pre>
  
  <p>I have also tried using 127.0.0.1 instead of localhost. It doesn't work either.Here is the CGI script that I'm trying to run</p>
  
  <pre><code>#!/usr/bin/python
  import MySQLdb,cgi, os, sys
  db=MySQLdb.connect(host="localhost", user="root", passwd="", db="test")
  flag=False
  query = db.cursor()
  sys.stdout.write("Content-type: text/html\r\n\r\n")
  sys.stdout.write("")
  sys.stdout.write("&lt;html&gt;&lt;body&gt;")
  form = cgi.FieldStorage()
  name = form.getvalue('temp')
  passwd = form.getvalue('temp2')
  
  if(query.execute("select * from cred where uname='"+name+"' and pass='"+passwd+"'")):
      db.commit()
      sys.stdout.write("Hello "+name)
  
  else:
      db.commit()
      flag=True
  sys.stdout.write("&lt;/body&gt;&lt;/html&gt;")
  
  if(flag == True):
      print "Location:http://localhost:8000/"
      print ""
  </code></pre>