Docs
Shorten redirect chains
Shorten redirect chains
A redirect sends the browser to another address before anything loads. One is normal: http:// to https://, or www to the address without it. Each extra hop is another round trip to the server, often with a new connection and TLS handshake. On a phone that is a few hundred milliseconds of blank screen per hop, before the page even starts. Search engines follow chains too, but they spend crawl time on them and give up after a few hops.
The site checklist follows the address your monitor uses to the final page and expects at most one redirect.
How chains happen
A typical chain grows from rules that were each added for a good reason, by different people, in different places:
| Step | Address | Who redirects |
|---|---|---|
| 1 | http://www.example.com/ → https://www.example.com/ |
the hosting panel's "force HTTPS" switch |
| 2 | https://www.example.com/ → https://example.com/ |
a www rule in .htaccess or at the CDN |
| 3 | https://example.com/ → https://example.com/en/ |
a language plugin |
Three hops where one would do. The fix is always the same: every variant goes straight to the final address in one rule. http://www.example.com/anything should land on https://example.com/anything in a single 301.
Other common causes:
- Trailing slash.
/about→/about/(or the other way round) adds a hop when your links and menu use the other form. - CMS address mismatch. WordPress redirects to the address in its settings. If that says
https://www.example.comand the server sends visitors to the address withoutwww, the two fight: a second hop or a loop. - CDN plus origin. Cloudflare redirects
httptohttps, then the server redirectswwwto the bare domain. Each is fine on its own, together they make two hops. - Old redirects pointing at old redirects.
/old→/newer→/newest, after two redesigns.
Check it yourself
Follow the chain and print every step. Replace example.com with your site:
curl -sIL http://www.example.com/ | grep -iE '^(HTTP/|location:)'
Each location: line is one redirect. Fixed means one location: line, or none when you start from the final address.
To test all four variants at once:
for u in http://example.com/ http://www.example.com/ https://example.com/ https://www.example.com/; do
curl -sL -o /dev/null -w "$u → %{url_effective} (%{num_redirects} redirects)\n" "$u"
done
Every line should end at the same address with 1 or 0 redirects.
Note: Browsers that already know your site's HSTS header skip the
http://hop internally. First-time visitors, crawlers andcurldo not, so count it.
How to fix
Find where each hop comes from (the curl output shows the order), keep one place that knows the final address, and switch off or rewrite the others. Pick what you have access to.
WordPress
- Settings → General: WordPress Address (URL) and Site Address (URL) must be exactly the final address,
https://and with or withoutwwwthe same way the server redirects. A mismatch here causes an extra hop on every page. - Redirect plugins. In the Redirection plugin (Tools → Redirection), or in Yoast SEO Premium or Rank Math redirects, look for chains: if
/oldpoints to/newand/newpoints to/newest, change/oldto point at/newestdirectly. - HTTPS plugins. If Really Simple SSL redirects to
httpsand your host does as well, keep one. The plugin's redirect runs only after PHP starts, so the server's rule is the faster one. - Language plugins. If
/redirects to/en/, WPML and Polylang can serve the default language without a language folder, or stop redirecting by browser language. That removes the hop for the homepage. - Permalinks. Use links in menus and content in the same form as Settings → Permalinks (with or without the trailing slash), so WordPress does not redirect them.
Clear the page cache afterwards (WP Rocket, LiteSpeed Cache, your host's cache).
cPanel
cPanel has two separate switches that are easy to stack: Domains → Domains → Force HTTPS Redirect and a www rule in Domains → Redirects. Together they make http://www take two hops.
Turn both off and use a single rule in .htaccess instead:
- Open Files → File Manager, go to
public_html, and in Settings tick Show Hidden Files (dotfiles). - Edit
.htaccessand put the block from the Apache and LiteSpeed tab at the very top, before the# BEGIN WordPresssection if there is one. - Test with the
curlloop above.
Plesk
- Websites & Domains → example.com → Hosting & DNS → Hosting: set Preferred domain to the form you want (with or without
www), and turn on the Permanent SEO-safe 301 redirect from HTTP to HTTPS. - Remove any extra
wwworhttpsrules you added to.htaccessor to Apache & nginx Settings for the same purpose. - Test all four variants with the
curlloop above. Ifhttp://wwwstill takes two hops, turn off the Plesk switches and use one rule instead (nginx or Apache tab).
nginx
The usual mistake is a port 80 block that keeps the host (https://$host$request_uri), so http://www goes to https://www first. Name the final host directly. On Debian and Ubuntu the site is in /etc/nginx/sites-available/example.com, on Rocky, Alma and CentOS in /etc/nginx/conf.d/example.com.conf:
# Every http request, with or without www: one hop to the final address.
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
# https://www: one hop as well.
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
return 301 https://example.com$request_uri;
}
Certbot adds if ($host = www.example.com) { return 301 https://$host$request_uri; } blocks; those keep www and create the extra hop. Replace them with the blocks above.
Test and apply:
sudo nginx -t && sudo systemctl reload nginx
Apache and LiteSpeed
One rule for both http and www, in .htaccess at the top or in the virtual host:
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301]
Remove older rules that do only one of the two, otherwise they still run first. If you prefer www, use RewriteCond %{HTTP_HOST} !^www\. [NC] and https://www.example.com instead.
Warning: Behind Cloudflare or another proxy,
%{HTTPS}isoffeven forhttpsvisitors, and this rule loops. UseRewriteCond %{HTTP:X-Forwarded-Proto} !httpsinstead of the first condition, or do the redirect at Cloudflare (Cloudflare tab).
On your own server, test and reload (httpd instead of apache2 on Rocky, Alma and CentOS):
sudo apachectl configtest && sudo systemctl reload apache2
Cloudflare
Always Use HTTPS (SSL/TLS → Edge Certificates) sends http://www to https://www; a separate www redirect then adds a second hop. Make one redirect rule that catches both:
-
Go to Rules → Redirect Rules and Create rule.
-
Custom filter expression, then Edit expression:
(http.host eq "www.example.com") or (not ssl) -
URL redirect: type Dynamic, expression
concat("https://example.com", http.request.uri.path), status 301, tick Preserve query string, and Deploy.
The www hostname needs a proxied DNS record (orange cloud) for the rule to run. Then check that the origin does not redirect again: if WordPress or the server still sends visitors to www, the two loop. The edge and the origin must agree on one final address.
Node.js and Next.js
Next.js redirects /about/ to /about (308) by default, or the other way round with trailingSlash: true. Use the same form in your links. For www, a single rule in next.config.js:
module.exports = {
async redirects() {
return [
{
source: '/:path*',
has: [{ type: 'host', value: 'www.example.com' }],
destination: 'https://example.com/:path*',
permanent: true,
},
];
},
};
On Vercel or Netlify, set the redirect between www and the bare domain in the project's domain settings instead, and keep only one of the two. If nginx sits in front of the app, put the redirect there (nginx tab) and not in both places.
Hosted platforms
Shopify, Wix, Squarespace and Webflow redirect every other domain to the one you mark as primary, in a single hop. Check that the primary domain is the one you link to: in Shopify Settings → Domains, in Webflow the default domain under Site settings → Publishing. A chain on these platforms usually comes from your own entries in the platform's URL redirects list, pointing at addresses that redirect again.
Confirm the fix
Run the curl loop from Check it yourself again, then open the target in PulseKeeper and click Check now on the Checklist tab. The item turns OK within a few minutes instead of at the next daily run.