def get_entrypoint(request_path):
    """ Get the entrypoint url from a request path, splitting off sub-indexes and query strings """
    entrypoint = request_path.replace('/index', '').split('?')[0]
    if entrypoint == '':
        entrypoint = '/index'
    return entrypoint