Open
Description
We should document how to use a redirect to serve a site on both www.example.com
and example.com
.
One way of redirecting one domain to another is deploying your origin website to the www domain, and setting up another project associated with the non-www domain which serves a simple redirection using JavaScript code as follows:
Deno.serve(() => Response.redirect("https://www.example.com/", 301));
This code will ensure that visitors to the non-www domain get redirected to the www domain with HTTP status code 301 (permanent redirect).