Erster Schritt ist richtig eingestellt, die Fehlerbehandlung zu haben, wo in Sie richtigen Fehlercode in dem Antwortstatus setzen.
Probe für die Fehlerbehandlungsroutine für 404
Konfigurationen 404.jsp
<%
if (com.day.cq.wcm.api.WCMMode.fromRequest(request) != com.day.cq.wcm.api.WCMMode.DISABLED) {
%>
<%@include file="/libs/sling/servlet/errorhandler/404.jsp"%>
<%
} else {
response.setStatus(404);
}
%>
Der nächste Schritt ist Apache/Abfertiger so konfiguriert korrekte Fehlerdokument (Konfiguration in Virtual Host config) zu laden. Auf diese Weise der richtige Belastung der Fehlerseite an dem Apache/Dispatcher delegiert wird -
<LocationMatch "^/content/secondapp/country-1/en/.*$">
ErrorDocument 404 "/country-1/not-found.html"
ErrorDocument 500 "/country-1/error.html"
</LocationMatch>
<LocationMatch "^/content/secondapp/country-2/en/.*$">
ErrorDocument 404 "/country-2/not-found.html"
ErrorDocument 500 "/country-2/error.html"
</LocationMatch>
<LocationMatch "^/content/secondapp/country-3/en/.*$">
ErrorDocument 404 "/country-3/not-found.html"
ErrorDocument 500 "/country-3/error.html"
</LocationMatch>
<LocationMatch "^/content/secondapp/country-4/en/.*$">
ErrorDocument 404 "/country-4/not-found.html"
ErrorDocument 500 "/country-4/error.html"
</LocationMatch>
Above Konfiguration basiert auf dem kurzen URLs, wo in dem Muster /content/secondapp/country-x/en/.*
verkürzt to /country-4/en/.*
und jeder Standort hat seine eigene Seite error.html und nicht-gefunden.html