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
Jarik Oosting is one of the Netherlandsโ best-known SEO and GEO specialists and is the founder of SmartRanking. With more than 15 years of experience, he has worked on over 150 SEO and GEO projects for Dutch and international companies. His expertise ranges from technical SEO and complex migrations to strategies and visibility in AI models.
In January 2025, Jarik introduced GEO (also called AEO) to the Netherlands. He wrote the Dutch book “GEO โ Zichtbaar zijn in de antwoorden van AI” about AEO, is an author and editor at Frankwatching, and a contributor to Marketingfacts. As a speaker at events, he shares his knowledge about SEO, GEO, and the search landscape.