I am using google app engine with python and webapp2, and i can't find the way just to redirect to an external web site using an absolute uri.
For example:
class Landing(BaseHandler):
def get(self):
self.render("landing.html")
def post(self):
name=self.request.get("name")
if name == "yes"
self.redirect("/")
else:
self.redirect("http://example.com") **This is the problem as I want to redirect to an absolute url.
The self.redirect always redirects to a relative url. How could I do a redirection to an absolute url? I think it has to be easy but I can't find the way.
Works fine for me and does not only redirect to a relative url. Please check your config of your host, browser and caching.
GAE just redirected me to example.com using it on my dev and production server
Take care though that example.com redirects to http://www.iana.org/domains/example/
That might be confusing you.
Try using eg self.redirect("http://www.facebook.com")
. That will redirect you to facebook. Simple.
Also.. I think I may have been bitten by the fact that there is no return in your code - so even after you've called the self.redirect(...) bit, if you write anything else to self, that may mess up your redirect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With