Issue
- The purpose lt of this article is to provide instructions on how to redirect users to a custom page in case of error code 404; instead of displaying the default page.
Environment
- DXP 7.0+
Resolution
There are two alternative approaches:
- With a custom site page:
- Create a page from Site Administration where the user will be redirected when accessing a non-existing page. For example:
/web/guest/page404.- Note: When the page is created, you can choose Hide from Navigation Menu so that it will not display in the navigation menu.
- Set the property's value to the created page in the
portal-ext.propertiesfile:layout.friendly.url.page.not.found=/web/guest/page404
- Create a page from Site Administration where the user will be redirected when accessing a non-existing page. For example:
- With a custom JSP page:
- Create a custom JSP page and place it in
/webapps/ROOT/html/portala directory. For example:404.jsp. - Set the property's value to the created page in the
portal-ext.propertiesfile:layout.friendly.url.page.not.found=/html/portal/404.jsp
- Create a custom JSP page and place it in
Additional Information
- Starting with DXP 7.3:
- The first approach (with a custom site page) is functional after solution LPS-123054 has been included in Fix Pack 1.
- On the second approach (with a custom JSP page) please see: How Do I Resolve "Page Not Found" Errors Thrown by Custom 404.jsp Pages in 7.3?