I think you need to append a prefix http://
or https://
to "www.google.com"
. Otherwise Flask is treating that as a relative url inside app.
So below will be a 404 as it's going to "localhost:5000/www.google.com"
@app.route('/test') def test(): return redirect("www.google.com")
But if you try with http://
, it should work fine.
@app.route('/test') def test(): return redirect("http://www.google.com")