Legacy Knowledge Base
公開されました Jun. 30, 2025

Liferay がカスタム エラー ページにリダイレクトされない

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.

問題

  • Liferay の静的ページは、portal-ext.properties に次のプロパティを使用して構築されています。

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

    URL にアクセスします: https://xyz/web/error/error404 (ここではデモンストレーションのみを目的としています)
    Liferay リソースが見つからないというエラー ページが、検索バーとサインイン ポートレットと共に表示されます。
    予想される動作: アプリケーションは、この URL にアクセスした後、エラー ページにルーティングする必要があります。

Environment

  • Liferay DXP 7.4

解決策

  • との競合避けるため 、エラー ページの両方の 指定 てください /web/error/error404 portal-ext.properties ファイル内。
    • /web を含む URL は、パブリック サイトが存在する場合はそのサイトにリダイレクトされ、サイトが存在しない場合はエラー ページにリダイレクトされます。 特定のページの FriendlyURL /web/<groupFriendlyURL>/<pageFriendlyURL>になります。

追加情報

  • この使用例をテストするには、値を layout.friendly.url.page.not.foundと同じにすることができます。 したがって、バニラ インスタンスで実行できる手順はのとおりです。
    1. 新しいデータベースで Liferay を起動します。
    2. コントロール パネル > サイトに移動します
    3. error という名前の新しいサイトを作成します
    4. 404 という名前の Web コンテンツを作成する
    5. 新しいエラー サイトで、Site Builder > Pages > に移動し、error404 というタイトルのページを作成します。
    6. error404 ページの friendlyURL を /error404 に設定します。
    7. error404 ページに Web コンテンツ表示を配置し、404 コンテンツを選択します。
    8. ポータルをシャットダウンし、 layout.friendly.url.page.not.found および sites.friendly.url.page.not.found を両方とも /web に設定します。 /error/error404 portal-ext.properties の
    9. Liferayを再起動
    10. localhost:8080 の後にランダムな URL を入力すると、ユーザーが Web コンテンツを含む error404 ページにリダイレクトされることに注意してください。
Did this article resolve your issue ?

Legacy Knowledge Base