You can follow this guideline: https://flask.palletsprojects.com/en/1.1.x/api/#url-route-registrations
from flask import Flask
app = Flask(__name__)
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def catch_all(path):
return 'You want path: %s' % path
if __name__ == '__main__':
app.run()