The main site sends phones to m.example.com, and the mobile domain sends them back. The error may depend on the User-Agent — the browser-type string — cookies — the user's saved choice — and the HTTPS indicator on an intermediate server. To find the cause, retry from a phone and a computer, both with and without the version-choice cookie. Save the URL for each redirect from the response's Location header.
Save the URLs before the first repetition
Server-side redirects specify a transition using an HTTP response and the Location header. Official documentation.
In Network, enable log preservation and reopen the main URL. Write down each document request, status, and Location up to the first repeated URL. During a loop, the browser may show only the final error, so the chain is more useful than a screenshot. Note the exact entry URL and session conditions. If only the protocol changes, check the HTTPS rules; if the host changes, check version selection. These causes can occur together. Do not increase the redirect limit as a presumed fix: a repeated URL indicates conflicting rules that need to be resolved.
In a terminal, a developer can check the rule for a mobile-browser string:
curl -sS -L --max-redirs 10 -A 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X)' -D headers.txt -o response.html 'https://example.com/service/'When there is a loop, curl stops after ten redirects and reports an error. In headers.txt, look for repeated URLs on the mobile and main domains. Do not increase the limit as a fix: the repeated pair of rules needs to be resolved. Replace example.com with your domain; this GET request does not change site settings. curl documentation.
The curl code 47 means the redirect limit was reached. Find the repeated URL in the saved Location headers. This User-Agent helps reproduce a server-side rule, but by itself does not make the request a real mobile-browser request.
Retry the entry under different conditions
| Visitor entry | Rules in effect | What to fix | How to confirm there is no loop |
|---|---|---|---|
| Computer, with no saved choice | Desktop version | Check the final host | No return redirect |
| Phone, with no saved choice | Mobile policy | Record the chain | No loop |
| Phone, with a saved choice of desktop version | User choice | Preserve the user's intent | Check the exception |
| HTTP through a proxy | Upgrade to HTTPS | Compare the original scheme | No repeated redirect |
Check HTTPS behind a trusted proxy
Ask a developer to check whether HTTPS terminates on an intermediate server before the application. In that case, the application may receive internal HTTP and mistakenly treat the visitor as unprotected. Check the designated headers that pass the original scheme and verify trust in the specific proxy. Do not unconditionally trust an arbitrary client-supplied header: its value must be set by your infrastructure. Compare the public entry point with the application log without exposing private data. If the redirect to HTTPS repeats regardless of the mobile domain, find and fix the setting that makes the application treat HTTPS as HTTP. Then check the mobile-domain switch again.
Reproduce the conflict between two domains
Suppose the main domain sends phones to m.example.com, while the mobile domain has a general rule that sends them back to example.com. After the second response, the URL repeats. Record this pair separately from the longer redirect history. On a test copy, change one of the two conflicting rules and retry from a phone without a cookie. A successful computer entry is not enough: the loop may not have appeared there in the first place. Add a direct entry to m.: it should have its intended destination, not create the same loop again.
Keep version selection in one place
Decide which layer selects the desktop or mobile version: the CDN, server, or application. Remove conflicting rules at other layers: the CMS should not send visitors back after the CDN has sent them to the mobile domain. Keep the required HTTPS redirect, but do not duplicate the device-dependent rule in two places. Check the order of exact exceptions and the general handler. If you need to migrate m. to the responsive main version, prepare a path mapping as a separate task. Fixing the loop is not a reason to automatically change the architecture of the whole site or replace product pages with the home page.
Check direct entry to both domains
A phone without a cookie opens the selected version without returning to a URL it has already visited. Retry an internal page on both domains and manually switch versions: the path and user's choice should be preserved. The HTTPS rule should not repeat either.
Also read: How to fix an infinite redirect loop and How to use reChecker to analyze redirects. Site checks are available on the reChecker technical audit page.