Custom domain's subpages not redirecting to GitLab subpages

Hi!

I have created a custom domain (https://www.nalkas.nu/) that I am to point to my GitLab project (https://joafr.gitlab.io/blog/). So far I have:

  1. Registered a custom domain via CloudFlare.
  2. Deploy the pages by connecting the GitLab repository to Netlify
  3. Setup deployment to the custom domain via Netlify

Now, I manage to get the main page https://www.nalkas.nu/ to point to https://joafr.gitlab.io/blog/, but I do not manage to get any subpages, like https://www.nalkas.nu/blog/posts/2018-12-20-introductory-course/ to point to https://joafr.gitlab.io/blog/posts/2018-12-20-introductory-course/. As you can see I am getting 404:s when I try to access these subpages.

I hardly know any HTML or JavaScript or anything so please be gentle and very explicit in your replies. I would be very, very grateful for some help here.

hey there, is this helpful at all?

Yes, thank you! Sorry for posting similar issues several times.

1 Like

Hello!

I am having a similar issue, but following the steps proposed above doesn’t do the trick. Initially, I deployed my website on Netlify with a default domain (.netlify.com) that pointed to my GitHub repo. I have recently registered my domain via Netlify, but from my GoogleAnalytics I still see people going on my .netlify.com (now, .app) page, instead of on the right website (www.lucacarbone.com).
Probably, I am doing something wrong following the instructions above. I have created a new file in my public folder (which is my publish directory) and I’ve tried both with /* /index.html 200 and with /app/* /app/index.html 200! but none redirects to my current page. Do you have any suggestion?

Thank you,
Luca

Hi, @lucacarbonelc, it looks like you have found the solution already. I was going to suggest the following redirect in _redirects format:

https://lucacarbone.netlify.app/ https://www.lucacarbone.com/ 301!

However, you already have that rule in netlify.toml:

[[redirects]]
  from = "https://lucacarbone.netlify.app"
  to = "https://www.lucacarbone.com"
  status = 301
  force = true

I would recommend a second rule be added to redirect other pages/assets to the custom domain as well:

[[redirects]]
  from = "https://lucacarbone.netlify.app/*"
  to = "https://www.lucacarbone.com/:splat"
  status = 301
  force = true

With both redirect rules, nothing will be served from lucacarbone.netlify.app except 301 redirects to the custom domain. Only the custom domain will be used for the site with both rules in place.

If there are any questions about this, please let us know.