Liferay is not redirecting to the custom error page

Issue

  • A static page in Liferay has been built with the following property to portal-ext.properties.

    layout.friendly.url.page.not.found=/web/error/error404

    Hit the URL:  https://xyz/web/error/error404 (just for demonstration purposes here)
    The Liferay resource not found error page will be visible, along with the search bar and the sign-in portlet.
    Expected Behavior: The application should route to the error page after hitting this URL.

Environment

  • Liferay DXP 7.4

Resolution

  • To avoid conflicts with this, be sure to specify both properties for the error page: layout.friendly.url.page.not.found and sites.friendly.url.page.not.found both to /web/error/error404 in the portal-ext.properties file.
    • Any URL that contains /web will redirect to a public site if it exists, or an error page if the site does not exist. A friendlyURL for a specific page would be /web/<groupFriendlyURL>/<pageFriendlyURL>.

Additional Information

  • To test this use case, the value can be the same as layout.friendly.url.page.not.found. Thus, the following are steps that can be taken in vanilla instance:
    1. Start Liferay with a fresh database.
    2. Go to Control Panel > Sites
    3. Create a new site named error
    4. Create a web content named 404
    5. In the new error site, Go to Site Builder > Pages > create a page titled error404.
    6. Configure  friendlyURL of the error404 page to be /error404
    7. Place a web content display on your error404 page and select your 404 content.
    8. Shutdown the portal and set the layout.friendly.url.page.not.found and sites.friendly.url.page.not.found both to /web/error/error404 in portal-ext.properties
    9. Restart Liferay
    10. Type any random url after localhost:8080 and notice users are redirected to the error404 page with your web content.
Este artigo foi útil?
Utilizadores que acharam útil: 0 de 0