Today I Learned
You can set up a delated redirect with the Meta HTML tag. Conveniently you can use this in a 404 exception handler if your site moved to catch any possible route/link users go to.
I did to redirect people to the new location of the FastHTML gallery site.
from fasthtml.common import *
= "https://gallery.fastht.ml/"
new_url def _not_found(req, exc):
= Div(H1("We moved to ",A(href=new_url)(new_url))
msg "Please update your bookmark! Redirecting in 3 seconds..."))
P(return msg,Meta(http_equiv="refresh", content=f"3;url={new_url}")
= FastHTML(exception_handlers={404:_not_found})
app
serve()