title: how to validate url and redirect to some url using flask
body: <p>I want to validate url before redirect it using Flask.</p>
  
  <p>My abstract code is here...</p>
  
  <pre><code>@app.before_request
  def before():
     if request.before_url == "http://127.0.0.0:8000":
         return redirect("http://127.0.0.1:5000")
  </code></pre>
  
  <p>Do you have any idea? 
  Thanks in advance.</p>