Do your customers know your actual web address? Does it start with www? Chances are your customers type your company name and press enter or type your company name and add .com to the end. If you don’t have all combinations of addresses working, customers might think your website is broken or you don’t have a website or you’re out of business. Search engines will have this problem as well and think you have multiple websites with duplicate content which is a no-no for PageRank. It’s important to redirect combinations of web addresses to a single address. For example, OpenLava’s website is accessible from multiple addresses which redirect to our actual address of https://openlava.com.

  • http://openlava.com
  • https://openlava.com
  • http://www.openlava.com
  • https://www.openlava.com

Redirecting from one address to another must include a code to ensure page ranking is passed along. Using a code of 301 indicates to search engines the move is permanent and to forward page rank. A code of 302 indicates a temporary redirect and should be avoided. It’s easy to check a website’s redirect status by going to httpstatus.io, a tool for checking redirects. Enter the combinations of addresses for your website similar to OpenLava’s above.

correct redirection results
Optimized and correct redirection results.

Ideally, the redirection should occur once as shown above. Sometimes multiple redirect are required as shown below for a popular retailer which has an intermediate redirect step to select the correct language. As long as you’re redirecting with a 301 code you’re in good shape. The downside of multiple redirects is it takes longer for pages to load which decreases page rank.

Correct redirection results.

To implement the redirection to ensure your site is accessible by https://companyname.com add the following to the top of your .htaccess file.

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www. [NC]
RewriteCond %{HTTP_HOST} ^(?:www.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]

To verify the redirection is working go back to httpstatus.io and retest with various combinations of web addresses. You can also verify the redirections are working using your browser. Open a private window or tab and enter the address. Once you have verified it’s working close the window or tab and repeat for the other web addresses. It might be tempting to perform all the tests without closing and reopening windows and tabs but this would be an invalid test as your browser caches pages and images.

Leave a Reply