Simplify strip_session_url() so it can be used more generally