This guide outlines how to enable the WWW Redirect feature on SaaS Custom Domains, ensuring that traffic from your root domain (e.g., example.com
) automatically forwards to its WWW version (e.g., www.example.com
). This feature not only simplifies certificate management but also improves your site's SEO by avoiding duplicate content issues.
Benefits of WWW Redirect
Consistent URL Structure: Maintains a uniform URL format across your site, which can enhance user experience.
SEO Enhancement: Reduces the risk of penalization for duplicate content by search engines, which can improve your site's search engine rankings.
Simplified SSL/TLS Certificate Management: Automatically covers both the root and WWW versions of your domain, ensuring secure access through HTTPS.
How to Enable WWW Redirect in the UI
When creating the custom domain manually, simply check the Redirect to www checkbox.
How to Enable WWW Redirect in the API
When creating the custom domain through the API, set the redirect_to_www
property to true
.
Important Notes
Handling of WWW Subdomains: If you create a WWW domain (e.g.,
www.example.com
), enabling WWW Redirect will not lead to recursive redirects (likewww.www.example.com
). Instead, it ensures thatexample.com
redirects towww.example.com
.Handling non-www Subdomains: Redirecting to
www
only works for root domains. If you try to enable the www redirect for subdomains the request will fail.
e.g. trying to createtest.example.com
withredirect_to_www: true
will fail with400 Bad Request
.DNS Configuration: Upon enabling the WWW Redirect, Automated DNS Instructions Emails will contain additional instructions to ensure proper functionality of the redirect.
Redirect HTTP Status Code: We use
301 Moved Permanently
status code when redirecting towww
.Plan Thresholds: Custom Domain with WWW Redirect counts as two domains towards your plan. This is because we have to issue two TLS certificates for this type of domain β one for the root domain, and one for the
www
subdomain.
That's it! You have learned how to enable redirecting to the WWW subdomain.
β
Until next time, keep building!
Need more help? Reach out via the Intercom chat widget and we'll be right with you!