This is my code:
from http.server import HTTPServer, BaseHTTPRequestHandler
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(b'some text')
def redirect(location):
# redirect
server = HTTPServer(('localhost', 1111), Handler)
server.serve_forever()
How can I write a function to redirect from a path to another?