Redirects · Checked once per domain
Path preservation in redirectsWhat it checks and how to fix it
What it checks
Requests a made-up path (/test-audit-path-12345) on the http:// version of the host and on its www or non-www counterpart. For each one that redirects, it passes when the Location keeps the path and fails when the redirect drops it, typically by sending everything to the homepage; it skips when neither version redirects.
Why it matters
A redirect that discards the path sends every deep link, bookmark and backlink pointing at the http:// or other www form of a URL to your homepage instead of the page it named. Visitors lose their place, and search engines treat a redirect to the homepage as a soft 404, so the ranking value of those links is lost.
How to fix it
Carry the request path (and query string) over in every host or scheme redirect.
# nginx: keep $request_uri, never redirect to a fixed "/"
return 301 https://example.com$request_uri;
# Apache: mod_alias Redirect appends the rest of the path automatically
Redirect permanent / https://example.com/
# Rails: config/routes.rb, redirect another host keeping path and query
constraints(host: "www.example.com") do
get "(*path)", to: redirect(host: "example.com", status: 301), format: false
end
Cloudflare: in a Redirect Rule, use a dynamic target such as concat("https://example.com", http.request.uri.path) and tick "Preserve query string" (the built-in "Redirect from WWW to root" template already does this).
curl -sI http://example.com/some/deep/page