def send_error(self, code, message=None): if code == 404 and self.path in ('/', ''): self.send_response(code, message) self.send_header("Content-Type", "text/html") self.send_header('Connection', 'close') self.end_headers() self.wfile.write('<meta http-equiv="refresh" content="0; URL=%s">' % self.gitweb_url) else: CGIHTTPRequestHandler.send_error(self, code, message)