File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,30 @@ organization for use with other applications.
176176This removes the custom domain from your organization and deletes all domain
177177assignments across all applications.
178178
179+ ## Redirecting between apex and www domains
180+
181+ If you want your site to be available on both ` www.example.com ` and
182+ ` example.com ` , we recommend serving your primary site on one of the domains and
183+ setting up a simple redirect on the other. A common pattern is to host your site
184+ on ` www.example.com ` and redirect all traffic from ` example.com ` to the ` www `
185+ domain.
186+
187+ To do this:
188+
189+ 1 . Map ` www.example.com ` to your primary application.
190+ 2 . Create a second application and map ` example.com ` (the apex domain) to it.
191+ 3 . Deploy the following minimal program to the apex application to perform a
192+ permanent redirect (HTTP 301) to the ` www ` domain:
193+
194+ ``` ts
195+ Deno .serve (() => Response .redirect (" https://www.example.com/" , 301 ));
196+ ```
197+
198+ This ensures visitors to ` example.com ` are permanently redirected to
199+ ` https://www.example.com/ ` . If you prefer the opposite (redirect ` www ` to the
200+ apex), deploy the redirect app on ` www.example.com ` and point it to
201+ ` https://example.com/ ` .
202+
179203## Migrating a custom domain from Deploy Classic to Deno Deploy
180204
181205If you have previously set up a custom domain on Deploy Classic and want to
You can’t perform that action at this time.
0 commit comments