When it comes to your website’s domain, there’s one small technical detail that can have a big impact on your SEO, user experience, and overall site performance: how you handle the non-WWW and WWW versions of your site. If you’re not automatically redirecting traffic from one version to the other, you’re missing out on some important benefits and potentially creating harmful issues.
If your website is accessible via both the WWW and non-WWW versions (e.g., "www.example.com" and "example.com"), it creates a few issues:
To avoid these issues, it’s best practice to choose a preferred version (either WWW or non-WWW) and implement a permanent 301 redirect from the other version. Here’s how you can set it up based on different environments:
If your site is hosted on an Apache server, you can use the .htaccess file to set up the redirect:
To redirect non-WWW to WWW:
To redirect WWW to non-WWW:
If your site is hosted on an Nginx server, you can add the following configuration to your server block:
To redirect non-WWW to WWW:
To redirect WWW to non-WWW:
While DNS redirects are possible, they’re generally not recommended for handling WWW and non-WWW traffic because they don’t offer the same control as server-level redirects. Instead, it’s best to implement 301 redirects through your server configuration or CMS.
If you’re using a CMS like HubSpot or WordPress, you can usually configure your preferred domain through the platform settings. These platforms often provide built-in options to set up canonical URLs and handle redirects automatically.
Redirecting non-WWW traffic to WWW (or vice versa) is more than just a technical detail—it’s an essential part of your SEO, security, and user experience strategy. By setting up proper redirects, you’ll consolidate link equity, avoid duplicate content issues, and provide a consistent experience for your visitors.
If you’re not sure how to configure your redirects properly, reach out to ThinkFuel. We can help you optimize your website for better performance, SEO, and security.