def do_GET(self):
path = self.path.lstrip('/').split('?')[0]
print("GET: ", path)
# is the file in the redirects table?
if path in self.redirects:
path_to = self.redirects[path]
print("REDIRECT TO ", path_to)
self.send_response(301)
self.send_header('location', path_to)
self.end_headers()
return True
else:
# serve the file!
self.path = path
return SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
评论列表
文章目录