Legacy Knowledge Base
Published Jul. 2, 2025

Pages are indexed in the wrong language

Written By

István Gergely-Tárnoki

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

  • When we look for our page in Google search, some of the listed results has a locale we don't even use.
  • What can we do to resolve that and have the URL with the correct locale in the search results?

Environment

  • Liferay DXP 7.4 and Quarterly Releases
  • Liferay Portal 6.2, Liferay DXP 7.0, 7.1, 7.2, 7.3

Resolution

  • What you see in the Google search results is originated from Google's indexing mechanism.
  • If there are a lot of languages in your Language settings' Current languages, your page source will contain a lot of localizations in the canonical URLs. The URL with the other localization has been indexed by Google for some reason that stuck in the search results

Also, verify the following:

  1. Request locale enabled:
    • Verify the value of the following portal-ext property:
    • locale.default.request=false
    • If this property is activated (true), Liferay will try to determine the client's locale from the request.
    • Otherwise, It will set the default value from the JVM.
  2. JVM startup country/language:
    • For example, you can set a custom language in setenv.sh adding this line (Spanish):
    • CATALINA_OPTS="$CATALINA_OPTS -Duser.country=ES -Duser.language=es" 
  3. Restrict your scope languages:
    • If you only use a specific language in your portal/instance/site then we would suggest you removing every language besides that one from the current Languages settings.
  4. Check locale prepend friendly URL style
    • Having one specific URL for each language can be useful to avoid this issue.
  5. Simulate a request without adding language header to get the default language.
    • # Should return the content in the expected default locale (e.g. es_ES).
      curl <home-url>
      # Browser's locale
      curl --header 'Accept-Language: es-es' <home-url>
    • The issue could be reproduced If accept language header is needed to load the content in the default locale.
  6. After you have checked everything, you can request to recrawl your website, however, it should be done automatically after some time.

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base