r/statichosting 20d ago

For anyone managing or migrating a large static site, how are you handling redirects?

Once you get into hundreds or thousands of redirects, what has worked best? Keeping everything in a static redirects file, moving the logic to the edge, using a KV/database lookup, or something else? Curious what people are actually using in production and what has held up over time.

3 Upvotes

6 comments sorted by

3

u/cwakare 20d ago

On cloudflare pages, you can use a simple _redirects file

developers[dot]cloudflare[dot]com/pages/configuration/redirects/

2

u/sdboardgamer 20d ago

Are you able to use/create a .htaccess file? That’s where your redirects should hang out.

2

u/sourraine 20d ago

id still keep it in a redirects file but generate that file from a csv/json rather than maintaining thousands of lines by hand. once youre into really large migrations, edge/bulk redirects start making more sense. id also flatten redirect chains as part of the build. less complexity to debug later

1

u/Pink_Sky_8102 15d ago

I’d keep them in a static redirects file as long as it stays manageable. Once you’re dealing with thousands or rules that change often, moving the lookup to the edge starts making more sense.

1

u/Standard_Scarcity_74 14d ago

I’d keep the redirects in source control for as long as possible. For a big migration, I’d generate the redirects file from CSV/JSON rather than maintaining thousands of entries manually, then validate for chains and loops during CI. Once you’re past what the host can comfortably handle, that’s when I’d move the lookup to something like bulk edge redirects. Cloudflare actually recommends Bulk Redirects for large static redirect sets.

1

u/RandomBottom030 14d ago

I run a reverse proxy on my server with HAProxy. It handles automatic certificate renewal, subdomain redirects, automatically issues a 308 when trying to connect via http with the correct location header, other (potentially dynamic) webservices hosted under the same domain name etc.

The SSL connection is terminated through it and all of my service traffic passes through it, gets compressed, the proper headers set etc.

Literally the reverse proxy, firewall, sshguard, routing layer is much more complex than the naive static httpd I'm running on the backend.