Many websites contain a redirect chain. For example, a visitor might be redirected from http:// to http://www, and then to https://www. You can easily resolve a redirect chain using the code below.
A redirect chain consumes crawl budget and causes Google to crawl fewer pages on your website. As a result, Google is less likely to pick up on changes to your website, or may not visit certain pages at all.
This has a negative impact on your search visibility. Reducing and resolving redirect chains is an important part of technical SEO.
There are two ways to check if you have a redirect chain: using an online tool or a Chrome extension. We’ve developed an HTTP status code checker that lets you see right away which redirects occur for a given URL.
If you want to redirect the non-www version of your website (https://smartranking.nl) to the www version of your website (https://smartranking.nl), use the redirect code below.
RewriteEngine On RewriteCond %{HTTP_HOST} !^www. RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
If you want to redirect the www version of your website (https://smartranking.nl) to the non-www version of your website (https://smartranking.nl), use the code below.
RewriteEngine On RewriteCond %{HTTP_HOST} ^www.(.+) [NC] RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
Place the redirect code in your website’s .htaccess file. This file is located on the server, and you can edit it using an FTP program or through an online hosting environment. It’s important that the line RewriteEngine On is located above the redirect rules.
RewriteEngine On
With a passion for SEO and an unmatched drive for results, Jarik Oosting is the driving force behind SmartRanking. With over 15 years of experience in the field, he has built an extensive body of knowledge spanning technical SEO to complex site migrations. As the founder of SmartRanking, he has assembled a team of like-minded SEO specialists who help businesses achieve sustainable online growth.
His academic background in information science at the University of Groningen, with a specialization in natural language processing, gives him a unique perspective on the world of SEO. For Jarik, it’s not just about visibility in search engines, it’s about sharing knowledge and guiding businesses toward sustainable online success. That mission also led him to write a Dutch book about GEO.