Legacy Knowledge Base
Published Jun. 30, 2025

Custom error 404 page

Written By

Kanchan Bisht

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • A static page in Liferay has been built with the following property in 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 custom 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 friendly URL for a specific page would be /web/<groupFriendlyURL>/<pageFriendlyURL>.
  • We have the Utility page: Using Utility Pages from DXP 7.4 update 86 and above to achieve this custom error page.

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.
Did this article resolve your issue ?

Legacy Knowledge Base