def _match_url_start(ref, val):
    """
    Checks that the val URL starts like the ref URL.
    """
    ref_parts = ref.rstrip("/").split("/")
    val_parts = val.rstrip("/").split("/")[0:len(ref_parts)]
    return ref_parts == val_parts