legacy-knowledge-base
公開されました Sep. 10, 2025

ページが見つからない(404)場合、「デフォルト」(ゲスト)のWebサイトにリダイレクトされる

written-by

Prarthana Jadhav

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

learn-legacy-article-disclaimer-text

問題

  • ポータルサイトで不正なURLをヒットした場合、「要求されたリソースが見つかりません」エラーやPage not foundエラーで、その特定のサイトではなく、デフォルトサイトにリダイレクトされます。

環境

  • Liferay DXP 7.0

解像度

  • 観測された挙動は、Liferayの意図した挙動である。
  • この意図的な動作の背景には、不正なURLがヒットした場合、適切なメッセージを表示するページに移動する必要があることが挙げられます。 デフォルトでは、このためのランディングページはゲストサイトであるため、ゲスト/デフォルトサイトへリダイレクトされます。

追加情報

  • 要件がある場合 を使えば、Liferayがサイト固有の404ページに移動するようになります。
    • まずは404のHTMLページを自作する必要があります。 そうすれば、Liferayにこの2つのプロパティで使用するように指示することができます:
          #
      # 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
      Tomcatアプリケーションを使用している場合、プロパティで指定された場所は、物理的なディレクトリに変換すると、 /tomcat-9.0.17/webapps/ROOT/html/portal のような場所になるでしょう。
did-this-article-resolve-your-issue

legacy-knowledge-base