Legacy Knowledge Base
Published Jun. 30, 2025

Redirecting a non-www Domain to a www Domain

Written By

Jorge Diaz

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

Issue

  • How can I redirect traffic from my non-www domain (e.g., example.com) to my www domain (e.g., www.example.com)?

Environment

  • Liferay DXP 7.4
  • Quarterly Releases

Resolution

You can configure a redirect using Liferay's pattern redirect feature:

  1. Access your website and navigate to Configuration > Site Settings > Site Configuration > Site URLs. Remove the non-www domain, keeping only the www domain. (e.g., www.example.com)
  2. reate a new site specifically for handling the redirect. In the Site URLs configuration for this new site, add the non-www domain. (e.g., example.com)
  3. In the new site, navigate to Configuration > Redirection > Patterns and add the following configuration:
    • Pattern: ^(.*)
    • Target URL: https://www.example.com/$0 (Replace example.com with your actual domain)
    • User Agent: all

This configuration redirects all traffic from the non-www domain to the corresponding URL on the www domain. For example, example.com/page will redirect to www.example.com/page.

Additional Information

  • This method uses 302 redirects, which can negatively impact SEO. For optimal SEO, configure 301 redirects at your web server level if possible.
  • See Using Pattern Redirects for more details.

 

Did this article resolve your issue ?

Legacy Knowledge Base