If you want to have a whole comparison between Github pages and Gitlab pages, here is a more detailed article .
Before we start
Make sure that you have :
Deployed your Gitlab Pages (check this out if you ever want to deploy a react app)
A domain name registered
In this specific example, I’m going to use namecheap as registar.
The name of my subdomain is jsonvizz and my original app aaa will be hosted at jsonvizz.jadynekena.com. I hightly recommand you to name your subdomain as same as your repo name, in order to not be confused. In summary :
jsonvizz : replace it with yoursubdomain
jadynekena.com : replace it with yourdomain.com
jadynekena.gitlab.io. : replace it with yourusername.gitlab.io.
Go to Settings > Pages > New domain, then write down your subdomain URL in the Domain field. In my case, I wrote down jsonvizz.jadynekena.com. Now on Create New Domain.
You will now have the following screen :
⚠️ DO NOT FOLLOW GITLAB INSTRUCTIONS UP THERE !⚠️ As stated before, those instructions are wrong. The only thing you will need later on is the gitlab-pages-verification-code=... part in Verification status. Now let’s open another one with your advanced DNS settings.
In your advanced DNS settings
Step 1 : add a A record
In your DNS advanced settings, add a A record as follows:
The IP address here is pointing to the Gitlab Pages server.
Step 2 : add a CNAME record
There is no need to add a CNAME record in domain case.
Do not forget the . at the end of the Value field, it is an important detail.