You can use curl to inspect a website’s HTTP response headers for clues about redirects. Headers can show the destination and sometimes identify the application involved, but they do not always reveal which configuration or code caused the redirect.

Check the initial response

Open a terminal with curl installed, or connect to your server using SSH. Replace the example URL with the exact address you want to investigate:

curl -I "https://example.com/"

The -I option sends a HEAD request and displays the response headers. For example, a redirect response might include:

HTTP/1.1 301 Moved Permanently
Location: https://www.example.com/
X-Redirect-By: WordPress

This output is illustrative. The response you receive may differ.

Interpret redirect headers

Check the HTTP status and Location header. A redirect status such as 301, 302, 303, 307 or 308, together with a Location value, identifies the next destination.

X-Redirect-By is an optional clue. WordPress’s redirect function can add X-Redirect-By: WordPress, but the value can be changed or suppressed. Its presence does not identify the particular plugin, theme or rule responsible.

An absent X-Redirect-By header does not establish that the web server caused the redirect. Applications, proxies and other components may redirect without that header.

Follow the redirect chain

Display the headers at each HTTP redirect hop:

curl -I -L --max-redirs 10 "https://example.com/"

The -L option follows redirects. The explicit limit stops the request after ten redirects if a loop or unusually long chain is encountered.

Check a normal GET response

Some sites handle HEAD requests differently from normal page requests. In a Linux shell, inspect a GET response while discarding its body:

curl -sS -D - -o /dev/null "https://example.com/"

This displays the initial response headers without following redirects.

Understand the limitations

If the headers do not identify the cause, inspect the relevant application settings, web server rules and proxy or CDN configuration, where you have access. Header inspection alone cannot determine every redirect source.

Browser behaviour can also differ because of cookies, cached redirects or redirects implemented in JavaScript or HTML. Curl’s HTTP redirect handling does not execute page JavaScript.