Implementing strict rules for virtual hosts and friendly URLs
投稿者
Daniel Carrillo Broeder
knowledge-article-header-disclaimer-how-to
knowledge-article-header-disclaimer
legacy-article
learn-legacy-article-disclaimer-text
Issue
- Having the different URLs for the same content could potentially impact SEO by affecting how pages are indexed.
- Even when a virtual host is defined for a site, it is possible to access that site using the portal-wide virtual host and IPs as well as the virtual hosts for other sites:
- liferay.com
- liferay.com/web/example
- liferay-other.com/web/example
- Also, multiple URLs redirect to the same page
- liferay.com/home
- liferay.com/en/home
- liferay.com/web/example/home
Environment
- Liferay DXP, Quarterly Releases.
Resolution
- The general recommendation is to apply any advanced configuration to enable these restrictions or permanent redirections directly in the web server, for example, Apache or Nginx.
- By default, Liferay allows to access any page through the path regardless the domain being used.
- Nevertheless, there is a Feature Request in the roadmap to modify this behavior by implementing more restricting rules.
- There are some information to consider to try to avoid/minimize duplicated URLs within Liferay application:
- Configure a virtual host for the site - Configuring Virtual Hosts Site URLs: It will help to consolidate URLs but won't avoid accessing pages by /web/<id>/page url.
- Manage the language prefix in URLs - Locale Prepend Friendly URL Style: Configure how language prefixes appear in URLs, including the option to omit them for the default language.
- Set custom canonical URLs for pages if needed: Page Settings UI Reference: This ensures search engines understand the preferred URL for each page, further preventing duplication issues.
- Always test any of these configurations in a non-production environment before applying them to production.
did-this-article-resolve-your-issue