Zakum
Explore posts from serversCDCloudflare Developers
•Created by Zakum on 6/15/2024 in #pages-help
Subdomain as alias w/ Cloudflare Pages
Hi, I'm trying to use Cloudflare Pages/Rules/DNS to create a site that supports multiple subdomains and multiple localized paths for each subdomain.
https://luk.gg (hosted at https://subdomain-test-5h2.pages.dev)
When not specified with a subdomain (
something.luk.gg
), publisher
defaults to ags
.
When not specified with a localization path (luk.gg/de
), lang
defaults to en
.
These are set up in my site code.
I wish to add the following behavior:
luk.gg/ags
routes to ags.luk.gg
luk.gg/ags/de
routes to ags.luk.gg/de
luk.gg/ags/ja
routes to ags.luk.gg/ja
luk.gg/bno
routes to bno.luk.gg
luk.gg/bno/de
routes to bno.luk.gg/de
luk.gg/bno/ja
routes to bno.luk.gg/ja
and paths beyond the /de
should work normally: luk.gg/de/guides/7
etc.
I tried adding CNAME records with Name: ags
and Content: subdomain-test-5h2.pages.dev/ags
however this doesn't seem to connect the CNAME to Cloudflare Pages. Pages appears to require you go to the Custom Domains tab and set it up through there. Afterwards, checking the DNS record says:
..but I can't point it as an alias to a specific subroute such as /ags
.
As the site will be identical for all subdomains and routes, I don't want to set up a monorepo or maintain duplicate projects..
Any idea of how to accomplish this?1 replies