This site is a contrived example to demonstrate the 404 → 302 technique in action.
There are three ‘versions’ of this site, being served from three different subdomains:
This site. The latest version that you’re viewing right now. It’s a static site, being served with nginx.
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.)
If a page is not found on the latest site, we issue a 302 request to the 2017 site. If it’s not found there either, we issue a 302 request to the 1997 site. If it’s still not found there, we show a 404 error.
Here’s a more verbose explanation of the flow:
If a URL is found on this site, it is rendered.
If a URL is not found on this site, instead of a raising a 404 (not found) error, we issue a 302 (temporary redirect) to the earlier version of the site (2017.4042302.org). We use a 302 and not a 301 (permanent redirect) because we want the latest site to have the chance to override the URL in the future.
If the URL is found on the earlier version of the site, it is displayed by that site.
If the URL is not found on the earlier version of the site, that site also has a 404 → 302 mapping that forwards the request to The Internet Archive’s snapshot of my Geocities site (1997.4042302.org).
If the URL is found on my Geocities site, it is displayed.
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!