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:
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.
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.)
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: www → 2017 → 1997 → Show 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 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.
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 → 307 mapping that forwards the request to The Internet Archive’s snapshot of my Geocities site (1997.4042307.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!
💕 Like this? Fund us!
Small Technology Foundation is a tiny, independent not-for-profit.
We’re building the Small Web.