Explore Bato Web Agency Webflow Certified Partner Profile Explore Bato Web Agency Webflow Certified Partner Profile

How do you redirect www to the non-www domain?

blog-plx blog-plx2

First make both hostnames resolve to the correct service and add both to the hosting account. The SSL certificate must cover example.com and www.example.com before an HTTPS redirect can work cleanly. A browser establishes the secure connection before it receives the redirect, so an invalid certificate on the source name still causes a warning.

 

Set a single permanent redirect at the web server, CDN, or hosting platform. Preserve the path and query string so www.example.com/products?id=2 reaches the equivalent address on the root domain. Use one layer for the rule when possible; duplicate rules in the CDN, server, and application can create a loop.

 

In WordPress, set the WordPress Address and Site Address to the final non-www HTTPS URL. Replace old internal links where needed and clear WordPress, server, browser, and CDN caches. Do not perform a blind database replacement on serialized data without a WordPress-aware tool.

 

Test several old URLs with an HTTP header checker. Each should reach the final page through as few redirects as practical and return a normal success response. Update the canonical tags, sitemap, analytics properties, and external service callbacks, while leaving the redirect in place for old links and bookmarks.