A www redirect, also known as a www to non-www redirect or a non-www to www redirect, is a type of server-side redirect that is used to ensure that all traffic to a website is directed to either the www version of the URL or the non-www version of the URL. This type of redirect is used to avoid duplicate content issues and ensure that search engines and users are directed to the correct version of the website.
Setting up www redirects
There are two main ways to set up a www redirect:
- www to non-www redirect: This redirect directs all traffic to the non-www version of the website. For example, traffic to www.example.com is redirected to example.com. This can be done by using server-side technologies such as Apache or Nginx, by adding a code to the .htaccess file or by configuring the DNS settings of your domain.
- non-www to www redirect: This redirect directs all traffic to the www version of the website. For example, traffic to example.com is redirected to www.example.com. It can be done by using server-side technologies such as Apache or Nginx, by adding a code to the .htaccess file or by configuring the DNS settings of your domain.
It's important to pick one version of your website and stick with it, be it www or non-www. Choosing one of them and redirecting all traffic to that version will prevent duplicate content issues, and also it's easy for user to remember one version of your website. It's also recommended to make sure that all internal links within your website use the same version of your domain name.
It's also worth mentioning that Google Search Console allows you to set your preferred domain, it means that you can specify whether you prefer your site to be displayed as example.com or www.example.com. This will be used to determine the canonical version of your pages, and it means that if you have a redirect in place, but you have set the preferred domain as example.com and your server is redirecting to www.example.com it may cause duplicate content issues.
Improperly implemented redirects can cause a number of SEO problems, including:
- Duplicate content: If a website is accessible through both the www and non-www versions (e.g. www.example.com and example.com), it can be seen as duplicate content by search engines, which can negatively impact search rankings.
- Loss of link juice: Redirects can cause the loss of link juice, which is the value that search engines assign to links pointing to a webpage. If a webpage is redirected, any links pointing to the original page will no longer pass link juice to the new page.
- Crawl errors: Search engines use web crawlers to discover and index pages on a website. If a redirect is not properly implemented, the crawler may not be able to follow the redirect and will not index the new page, which can prevent it from appearing in search results.
- Confusing user experience: Redirects can cause confusion for users, especially if they are redirected to unexpected or unrelated pages. This can lead to a high bounce rate, which can negatively impact search rankings.
- Negative impact on page speed: Redirects can slow down the loading of a webpage if the browser has to go through multiple redirects before reaching the final destination. This can be especially problematic on mobile devices with slower internet connections.
It is important to ensure that redirects are implemented correctly to avoid these SEO problems. For example, ensure that all versions of the website (www and non-www) are redirecting to a single version of the website. Also, use a redirect to the permanent (301) instead of temporary redirects (302) which is recommended by google, this will help to pass the link juice to the new page.