How do I create a subdomain with pages?

For Workers & Pages, what is the name of the domain?

ddystopian.xyz

What is the issue or error you’re encountering

I am unable to create a subdomain

May I ask if you want to serve your website content on Pages when someone visits your sub-domain like if I visit sub.ddystopian.xyz it should load it, or? :thinking:

Yep! I am!

If you do already have an active domain (zone) added to your Cloudflare account, you can Connect custom domain (www, sub1, sub2 …) to your Pages project using steps from the below article:

Navigate to the Pages & Workers menu. Find your pages project, or create a new one. Assign the name, upload your content. Click on the Setup custom domain button in the interface. Enter your sub-domain as sub.yourdomain.com and Continue. The next step would ask you to confirm the changes which need to be done as it’ll be linked to yourdomain.com via CNAME type of the DNS record and proxied :orange: .

You might have to wait for some minutes so this sub-domain becomes active and working over HTTPS and after this it would resolve in your Web browser.
Once done, you’ll see something like on the below screenshot:

You can later confirm and verify if the DNS record was added successfully by navigating to the DNS tab, should be CNAME :orange: and pointed to the pages sub-domain of your Pages project:

slika

tHank U!

1 Like

I am happy to assist you :hugs:

This is what I see, what should I do now?

It looks fine, you shouldn’t need to change it or do anything else. The warning is there to let you know not to change it.

2 Likes

yeah, but how do i create a directory or how do I upload files to my subdomain?

You deploy this via comannd line interface, using Wrangler, otherwise you can upload a new version, updated, which contains some directories such as css, js, images, etc. and files as well via the Drag&Drop at the Dashboard as an “zip” archive or “folders” upload as follows on the article below.

Below article contains step-by-step instructions how to upload your files (or a zip file) of index.html and corresponding files (if you have them separately like CSS for styling, JS for some dynamic animations, etc., and images as well) through the Cloudflare dashboard.

Depending on your project, However, for Cloudflare Pages, ideally would be like I know to keep and make things simple:

  • main folder → named website
    • index.html → the main file which contains all the stuff needed (text, linked resources, etc.)
    • CSS directory → for any 3rd-party CSS stylings
    • JS directory → for any scripts I have
    • images directory → I put my images and icons here

After that structure, I make a zip archive from the “main folder” and then upload my zip to the Cloudflare Dashboard → Pages via Drag & Drop from my desktop.

You could share a screenshot of the “Assets uploaded”.

Click on View Details:

slika

And then there should be index.html (example from below):

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.