Use Django's is_safe_url for redirect checking