Legacy Knowledge Base
Published Jun. 30, 2025

How to Redirect a non-www Domain to a www Domain in Liferay DXP

Written By

Jorge Diaz

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

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 Site Menu > Configuration > Site Settings > Site Configuration > Site URL.
  2. Ensure only the www domain (e.g., www.example.com) is listed. Remove the non-www entry if present.
  3. Create 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)
  4. In the new site, navigate to Site Menu > Configuration > Redirection > Patterns and add the following configuration:
    • Pattern: ^(.*)
    • Destination URL: https://www.example.com/$0 (Replace example.com with your actual domain)
    • User Agent: all
  5. Click Save.

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.

Liferay Pattern Redirects use 302 (Temporary) redirects. For long-term SEO benefits, a 301 (Permanent) redirect at the web server level is generally preferred.

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base