Page not found (404) redirects to the 'default' (Guest) web site

Issue

  • When an incorrect URL is hit on the portal, the "The requested resource could not be found" error or Page not found error redirects to the default site and not to that particular site.

Environment

  • Liferay DXP 7.0

Resolution

  • The observed behaviour is an intended behaviour of Liferay.
  • The reason behind this intended behaviour is when an incorrect URL is hit, it should land on a page giving an appropriate message. By default, the landing page for this is the Guest site and hence it redirects to Guest/Default site.

Additional Information

  • If the requirement is to make Liferay go to site-specific 404 pages.
    • You'll need to create your own 404 HTML page first. Once you do so, you can point Liferay to use it with these two properties:
          #
          # Redirect to this resource if the user requested a friendly URL of a page
          # that does not exist. Leave it blank to display nothing.
          #
          # A similar configuration for sites is managed with the property
          # "sites.friendly.url.page.not.found".
          #
          # Note: For backward compatibility, this overrides the property
          # "layout.show.http.status" for the 404 status code.
          #
          #layout.friendly.url.page.not.found=/html/portal/404.html
          #
          # Redirect to this resource if the user requested a site friendly URL that
          # does not exist. Leave it blank to display nothing.
          #
          # A similar configuration for pages is managed with the property
          # "layout.friendly.url.page.not.found".
          #
          #sites.friendly.url.page.not.found=/html/portal/404.html
      If Tomcat application is being used, the location specified in the properties would translate to your physical directory to be something like /tomcat-9.0.17/webapps/ROOT/html/portal.
这篇文章有帮助吗?
1 人中有 0 人觉得有帮助