How to Implement WWW Resolve


What is the WWW Resolve?

The WWW Resolve takes a few sentences to wrap your head around. The WWW Resolve is a redirection command in the server's configuration file to either force "www." before the domain name or remove it. When you navigate to a website such as http://www.example.com, you might type that URL or you might type http://example.com. Several studies have found that around half of the users in the studies use http://www.example.com and the other half use http://example.com. If you actually navigate to http://example.com, you will see that the URL immediately changes to http://www.example.com. That is a proper WWW Resolve. If you were able to navigate to both URL versions of a website's domain, and the URLs do not change, then the WWW Resolve is not implemented. While www.example.com uses WWW Resolve to force a redirection to the URL with www, it is also possible to force all www URLs to URLs without the www. How you implement the WWW Resolve is entirely up to you, but you should definitely use it.

Why Implement the WWW Resolve?

The problem with websites that do not implement a WWW Resolve is that search engines see both URLs as being different. Since the URLs display to the same content, search engines are likely to consider these URLs as duplicate content. With no WWW Resolve, every page would be duplicate content. In this situation, every page on your website has the potential to be penalized. Implementing the WWW Resolve will completely eliminate this possibility.

Implementing the WWW Resolve

Despite the threat of being penalized by search engines for every page on your website, implementing the WWW Resolve is rather easy.

WWW Resolve with www.

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

WWW Resolve without www.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

Always Use Consistent URLs

Of course, this is the best way to implement the WWW Resolve. However, The WWW Resolve is not the ultimate solution to this duplicate content problem, but it is a crucial component for consistent URLs. It would be useful to make sure all of your canonical URLs also use the correct form. Search engines would be placed in a difficult position if it was always redirected to a URL with www. at the beginning, but the canonical URL did not have it. Also, consider other elements like images, if you do not provide a consistent URL, the request will have to be redirected for each image, which will result in a slower page load speed. Always be consistent with your URLs, whether they are in links, redirections, images, etc.