Check your web redirects and HTTP responses
Redirects with Caddy
Caddy is a modern, fast-growing web server, appreciated for its simple configuration and automatic HTTPS (Let's Encrypt certificate managed natively, no plugin required). Configuration is done in a text file called Caddyfile.
301 (permanent) redirect with Caddy
Redirect a specific page:
example.net {
redir /old-page.html /new-page.html 301
}
Redirect an entire domain to another:
old-domain.net {
redir https://www.example.net{uri} permanent
}
Force www (non-www → www):
example.net {
redir https://www.example.net{uri} permanent
}
www.example.net {
# your site here
}
Remove www (www → non-www):
www.example.net {
redir https://example.net{uri} permanent
}
example.net {
# your site here
}
302 (temporary) redirect with Caddy
example.net {
redir /old-page.html /new-page.html 302
}
HTTPS with Caddy
Caddy automatically enables HTTPS for any domain declared in the Caddyfile — it handles the Let's Encrypt certificate issuance and renewal itself. There is generally nothing to configure for HTTP → HTTPS redirect: it is the default behavior.
After modifying the Caddyfile: caddy reload or systemctl reload caddy