Skip to content
FunnelGuard

Fix guide by FunnelsGuard

www/non-www double redirect: how to find and fix it

PRF-069Low impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Your site can be reached at several addresses: http://example.com, http://www.example.com, https://example.com and https://www.example.com. You should pick one as the preferred (canonical) address and redirect the other three to it.

A double redirect happens when the redirect rules are stacked. The first rule fixes one thing (for example, adds https), and the second rule fixes another (for example, removes www). The visitor makes two extra requests before the page starts to load.

A typical www/non-www double redirect
  1. Ad clickhttp://www.example.com/offer?gclid=abc
  2. Hop 1: 301Adds https, keeps www
  3. Hop 2: 301Removes www
  4. Landing pagehttps://example.com/offer

Two redirects run one after the other before the real page is served.

Why it costs you leads or sales

Each extra redirect is a full round trip: DNS lookup, connection, TLS handshake and a response, all before any of your content arrives. On a slow mobile connection this can add a noticeable delay. Visitors who see a blank screen for longer are more likely to leave.

The impact is usually small, which is why this issue is rated low. It grows with paid traffic, because every ad click pays the delay. A badly written second rule can also drop the query string, which would lose gclid and UTM parameters. Check that your redirects keep them.

Time added before the page starts loadingExample numbers
Time added before the page starts loading (example)No redirect: 0 ms; One redirect: 150 ms; Two redirects: 300 ms01152300150300No redirectOne redirectTwo redirectsms

Example: illustrative delays on a mobile connection. Your real numbers will differ.

How to check if your site has it

Request each of the four address variants and count the hops. You want one redirect at most, and the exact same final URL every time.

Show every hop for each variantbash
for u in http://example.com http://www.example.com https://example.com https://www.example.com; do
  echo "== $u"
  curl -sIL -o /dev/null -w '%{num_redirects} redirects, final: %{url_effective}\n' "$u/?utm_source=test"
done

For the detail of each hop, run curl -sIL http://www.example.com/ and read the HTTP/ and location: lines. If num_redirects is 2 or more for any variant, you have a chain. Also check that utm_source=test is still in the final URL.

What a healthy result looks like (preferred address: https://example.com)
Start URLRedirectsFinal URL
http://example.com1https://example.com
http://www.example.com1https://example.com
https://www.example.com1https://example.com
https://example.com0https://example.com

How to fix it

The principle is the same everywhere: decide on one preferred address, then send every other variant straight to it. The redirect target must already include both the https scheme and the preferred host. The steps differ by platform.

Collapse the chain into one redirect
  1. Set one address

    Go to Settings > General and make WordPress Address (URL) and Site Address (URL) identical, using your preferred host and https.

  2. Remove duplicate rules

    Check your redirect or SSL plugins and your host's control panel. Keep one rule that does both the https and host change, and turn off the others.

  3. Check .htaccess

    On Apache, look for stacked RewriteRule blocks and replace them with the single rule shown under Custom code.

Apache: one rule, any variant to https://example.comhtaccess
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301,QSA]
Nginx: one hop to the preferred addressnginx
server {
    listen 80;
    listen 443 ssl;
    server_name example.com www.example.com;
    # ssl_certificate lines go here; the certificate must cover both names
    if ($host != "example.com") { return 301 https://example.com$request_uri; }
    if ($scheme = http) { return 301 https://example.com$request_uri; }
    # ... rest of your config
}
Redirect behaviour

Before

  • http://www goes to https://www, then to https://example.com
  • Two extra round trips for every ad click
  • Second rule may drop the query string

After

  • Every variant goes straight to https://example.com
  • One redirect at most
  • Path and query string preserved

How to confirm it's fixed

Verify the new behaviour
  1. Rerun the curl check

    Run the loop from the check section. Every variant should show 1 redirect or fewer and the same final URL.

  2. Test with parameters

    Open http://www.example.com/?gclid=test&utm_source=test and confirm both parameters are still in the final address bar.

  3. Clear caches

    Browsers remember 301s. Test in a private window or with curl, and purge your CDN cache if it holds old redirects.

  4. Check Search Console

    Make sure your preferred host is the one you have set up as a property, and that your sitemap and canonical tags use it.

How to prevent it happening again

Keep redirects clean
  • Write down your one preferred address and use it everywhere: ads, sitemap, canonical tags, internal links, email links.
  • Keep redirect rules in one place, not split across plugin, host and CDN.
  • Re-check all four variants after changing hosts, CDN, SSL or domain settings.
  • Use final URLs in ad campaigns so clicks skip the redirect entirely.
  • Keep the SSL certificate valid for both the www and non-www names.

How FunnelGuard handles this

FunnelGuard detects this today. A redirects check follows the redirect path a robot visitor sees when it opens your page, and flags when the chain has more hops than it should, such as a www/non-www double redirect. The robot runs on a schedule from the EU or the US, so you find out if a host, CDN or plugin change brings the chain back. It flags the chain, but it will not tell you which layer adds the hop, so use the curl check above to trace it. The Free plan covers 1 site and 2 journeys with daily checks and no card, and a free read-only website audit is available too.

Questions people ask

Why does my site redirect twice before loading?

Usually two separate rules each fix one thing: one adds https and another switches between www and non-www. Each runs after the other, creating two hops. Combine them into one rule that sends every variant straight to the final https address.

How many redirects is too many?

Aim for one redirect at most between any address variant and your final page, and zero for the preferred address itself. Two hops work but add avoidable delay, especially on mobile. Three or more should be fixed.

Is a www to non-www redirect bad for SEO?

No, a single 301 redirect to your preferred host is normal and recommended. The problem is stacked or inconsistent redirects, which add delay and can confuse crawlers. Pick one host, redirect to it once, and use it in canonical tags and sitemaps.

Should I use www or non-www?

Either works, so pick one and stay consistent. The www version gives some setups more flexibility with DNS and CDNs, while non-www is shorter. What matters is that all other variants redirect to your choice in one hop.

Does a redirect remove gclid and UTM parameters?

It can, if the redirect rule drops the query string. A correct rule keeps it, for example with the QSA flag in Apache or $request_uri in Nginx. Test by opening your URL with ?gclid=test&utm_source=test and checking the final address.

How do I check my redirect chain?

Run curl -sIL on your URL and read each location header, or use curl's num_redirects write-out to count hops. Test all four variants: http and https, with and without www. Each should end at the same URL in one hop or fewer.

Why do I get a browser warning on the www version?

Your SSL certificate probably does not cover the www name. The browser checks the certificate before it follows the redirect. Reissue the certificate so it covers both example.com and www.example.com.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: redirects matcher.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.