404 → 307

🌲 A simple gesture for an evergreen web.


This site is a contrived example to demonstrate the 404 → 307 technique in action.

There are three ‘versions’ of this site, being served from three different subdomains:

  1. www.4042307.org

    This site. The latest version that you’re viewing right now. It’s a static site, hackishly exported from Kitten and being served with nginx.

  2. 2017.4042307.org

    A fictitious previous version of the site. It is also a static site being served by different nginx server. (But it could easily have been a dynamic site being served by Node.js, for example.)

  3. 1997.4042307.org

    The oldest ‘version’ of the site is my Geocities site from 1997 that I downloaded from The Internet Archive using Wayback Machine Downloader. It is also being served by nginx.

If a page is not found on the latest site, we issue a 307 request to the 2017 site. If it’s not found there either, we issue a 307 request to the 1997 site. If it’s still not found there, we show a 404 error.

So: www20171997 → Show 404 error

In detail

Here’s a more verbose explanation of the flow:

  1. If a URL is found on this site, it is rendered.

  2. If a URL is not found on this site, instead of a raising a 404 (not found) error, we issue a 307 (temporary redirect) to the earlier version of the site (2017.4042307.org). We use a 307 and not a 301 (permanent redirect) because we want the latest site to have the chance to override the URL in the future.

  3. If the URL is found on the earlier version of the site, it is displayed by that site.

  4. If the URL is not found on the earlier version of the site, that site also has a 404 → 307 mapping that forwards the request to The Internet Archive’s snapshot of my Geocities site (1997.4042307.org).

  5. If the URL is found on my Geocities site, it is displayed.

  6. If the URL is not found, the Geocities site displays its 404 page.

This is a contrived example but it should be enough to demonstrate how you can use this technique on your own web sites.

So this is my solution and I’m documenting it here because I feel that if enough of us adopted it, we could make this the de facto way to foster an Evergreen Web.

Next: Get started!

💕 Like this? Fund us!

Small Technology Foundation is a tiny, independent not-for-profit.

We’re building the Small Web.

We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.