Everything you always wanted to know about URL redirection (but were afraid to ask)

HTTP is a protocol for fetching resources such as HTML documents. You can redirect at the service level, within a page or via JavaScript if enabled.

The simplest way to redirect to another URL is to use an HTML <meta> Tag1 with the http-equiv parameter set to refresh. The content attribute sets the delay before the browser redirects the user to the new web page.

To redirect immediately, set this parameter to zero second for the content attribute.

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="refresh" content="0; url='https://github.com/bhdicaire'" />
  </head>
  <body>
    <p>You will be redirected to BH Dicaire's Github soon!</p>
  </body>
</html>

However HTTP redirects always execute first thus using Cloudflare page serverless component is more elegant. I don’t need build a static html page per URL either manually or via a static site generator such as Hugo.

How does it work?

The secret sauce are two plain text files:

References