Different 404 handling

Good morning,

we’ve integrated the frontend login in our website and therefor we do have some “protected” pages. When you try to access these protected pages and you’re not logged in, the 404 page will be displayed. I now want to archive that if you try to access a protected page, that you will be redirected to the frontend login form. Is that possible?

This is our fusion configuration of the error / not found handling:

error {
    @context.notfoundDocument = ${q(site).children('[instanceof Neos.Neos:Document][uriPathSegment="404"]').get(0)}
    4xx {
        @position = 'start'
        condition = ${statusCode >= 400 && statusCode < 500 && notfoundDocument}
        renderer = Neos.Fusion:Renderer {
            @context.node = ${notfoundDocument}
            @context.documentNode = ${notfoundDocument}
            renderPath = '/root'
        }
    }
}

I’ve added this to the «error» part after «4xx» but this does not work either. :frowning: Anyone who can help me?

protected {
    @context.frontendLoginDocument = ${q(site).find('#f1d86dfe-2dcc-4464-a096-c44939c5a0b0').get(0)}
    @position = 'start'
    condition = ${q(node).is('[instanceof My.Website:ProtectedPage]') && statusCode >= 400 && statusCode < 500 && frontendLoginDocument}
    renderer = Neos.Fusion:Renderer {
        @context {
            site = ${frontendLoginDocument.context.currentSiteNode}
            node = ${frontendLoginDocument}
            documentNode = ${frontendLoginDocument}
        }
        renderPath = '/root'
    }
}