I’m trying to redirect my user to a different page but add something to the redirect url.
This is my code:
def view_linkshortener_redirect(request, token): packet = get_object_or_404(Link, uid=token) url = packet.link if 'http://' or 'https://' in url: return redirect(url) else: return redirect("http://" + str(url))
The first part works, if “http://” is included in the url the user gets redirected, if not the second part of the statment gets triggered, and the user gets redirected to my own domain and to the current page but adds the redirect url to mine so it throws an page not found error obviously.
How can I redirect the user to my new page including “https//:” in the url?
Thanks for your help!