How to customize URL in Cloudflare Pages using GitLab

I want to create a website using Cloudflare Pages in combination with GitLab and Eclipse. I managed to make a test work but I have a few changes that I want to make mainly around the URL format.

First as a note, for privacy reasons, I’ll change the names to more general ones.

That being said in GitLab I made a new project (private) and lets name it “My Personal Website”. Then inside Eclipse I cloned this newly created repository, and after that I created a new “Static Web Project” with the same name (“My Personal Website”). Inside it a folder named “public” was automatically created, in which I added two HTML files, one named “Home” and the other “Test”, and inside them I added only one row of text message.

After this I went to Cloudflare Pages and I made a new application of type “Pages” and I connected my git repository to it. After this I committed the changes made in Eclipse, which were detected by Cloudflare and now I can access my webpage using “my-personal-website.pages.dev” but here lies what I want to change. If I only use https://my-personal-website.pages.dev that page is blank with a black background. Instead of this, I want “Home” to be displayed. Also one more thing, if I want to access those two pages that I made, I need to go to https://my-personal-website.pages.dev/MyPersonalWebsite/public/Test for example. Another change that I want to make is that instead of “/MyPersonalWebsite/public/Test” I want to have straight https://my-personal-website.pages.dev/Test

What do I need to change/add to have these two changes? For this website that I want to make, I don’t need any server-side functions, as it will only be used to show information, also after I’m done, I’ll buy a domain and change it from pages.dev to my own domain, which I see it is easy as you have “Custom domains” in Cloudflare settings.

I solve this by doing the following steps:

  • In Eclipse go to Git Repositories, right click your GitLab repository, choose “Import Projects…”, and select your repository from that list
  • After this I moved the files “Home.html” and “Test.html” from the folder “public” to the root of this new project, and removed “My Personal Website” entirely which was “Static Web Project”.
  • Now I had to rename “Home.html” into “index.html” (or add a html file with that name if you don’t have a home page yet). Cloudflare is looking for a file with the name “index.html” in the root directory.

Now when I access https://my-personal-website.pages.dev, my “index.html” is displayed and to access “Test.html” I can simply use https://my-personal-website.pages.dev/Test.

So in theory what I should have done from the beginning would have been this:

  • Go to GitLab and create a private repository
  • Open Eclipse and clone that repository from “Git Repositories”
  • Also in Eclipse right click on that repository, select “Import projects…” and select the root
  • Inside the root add a file named “index.html” which will be displayed when the website is accessed
  • Commit the changes
  • Go to Cloudflare Pages and create a new application of type “Pages” and connect my git to it

Cloudflare would have then deployed the project and that would have been all.

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