After adding custom domain there are now 404 errors. Using Google and Project Pages #21570
-
Hello, I’ve been looking at many different threads here and online but I can’t seem to get my problem fixed. Some background: My page was originally working as intended under username.github.io/projectname but after I added a custom domain it brings up a blank page and going into the console it says I have 404 errors. I also have the CNAME file included too. Custom domain name is bought from Google and I am using a project page repo and not the profile one. (I’ve been making a lot of changes trying to fix this but I hope it’s not messing it up. I did wait 24 hours after first inputing the custom domain name but it seems to still give the same errors, thus all the changes you see now is currently taking place.) My google domain is set up like so. and my github settings: When I go to the website it opens up a blank page, I open up the console on “Network” and shows this: So I’m assuming that since it’s reading the html file then Google must be working correctly and there’s something going on with my repo’s references, right? When I click on each error I can see the request url is not including the docs/ folder in the path file. So I tried manually adding in the path but that still doesn’t work. I’ve been trying to edit the docs/404.html and docs/index.html pages by changing either the href or src but no luck. Most of the other tutorials online seem to only refer to the github profile version of _username.github.io _but some of them mentioned that it should work for both profile and project pages on the google domain. I’ve been stuck on this for hours now 😦 |
Beta Was this translation helpful? Give feedback.
Replies: 13 comments 4 replies
-
In your package.json file make sure the “homepage” variable is set to the same custom domain as well |
Beta Was this translation helpful? Give feedback.
-
A CNAME record is required if you want to use a subdomain for hosting your GitHub Pages site, for example From what it looks like in the screenshots you posted you have the following:
The contents of the blank page are:
And Unfortunately, I’m not going to be much help with getting the Angular part to work. But it appears that the GitHub Pages stuff is all working as it should be. I hope that helps! Let us know if you have more questions. |
Beta Was this translation helpful? Give feedback.
-
Hi, I’m not quite sure what you mean by “homepage” variable, is this something I need to include myself in the package.json file? My package.jscon looks like this. From what I found online it seems like the “homepage” variable refers to those using React, but I am currently trying to build my webpage with Angular. |
Beta Was this translation helpful? Give feedback.
-
Hi, thank you for checking if my configuration is set up correctly. So, correct me if I’m wrong, but I’m assuming since I have both the CNAME and A records configured it is somehow messing up how the webpage is showing right? So I removed the CNAME from my Google Domains (since I’m not using “www” for the subdomain) and kept the A record instead. It still seems to be showing the same errors (and a white blank page) but I’ll wait a day and keep you updated if something changes. What I’m more confused about is that if I do not use a custom domain name, and if I leave the site as http://shiniko.github.io/Portfolio, the website does show up correctly. So I thought I was doing the Github Pages configuration wrong. If there is no other problems with how I configure Github, I am still stuck on what could be the problem 😦 I’ve had problems with gh-pages and master branch being the sources so I had to use docs/ as the source for my website to actually show up (without the domain name). And if I’m only using docs/ as the source then I have to use the project pages as my repo. Is there anything else I can try? |
Beta Was this translation helpful? Give feedback.
-
Try creating a file named
Wait for the pages build to go through, then navigate to https://jamielynnculilap.com/test.html. This will test if it’s the custom domain configuration causing a problem or the Angular stuff causing a problem. If you don’t see the contents, then there’s something wrong with the domain configuration. If you do see the contents, then it’s the Angular stuff. I hope that helps! |
Beta Was this translation helpful? Give feedback.
-
hmm interesting, https://jamielynnculilap.com/test.html does show up fine, so it is on Angular. I’ll keep trying other solutions and update if I can get it to work. I am happy that the domain config is working as intended though! |
Beta Was this translation helpful? Give feedback.
-
OKAY GOT IT! Oh my, that took way too long to figure out. I would like to thank @lee-dohm for his suggestion about doing the “test.html” and double checking that my domain configuration was setting up correctly, it helped me figure out what was the problem with the blank page showing. What I did to fix the blank page : So for deploying to Github Pages I was following the Angular documentation shown below This one and a bunch of other tutorials pretty much had the same concept, but after checking the “Network” status from the “test.html” file (that @lee-dohm mentioned) I was looking at how it was requesting the URL. I realised that everytime the request was getting a 404 error the URL would look like: https: //jamielynnculilap.com/[name of repo]/[file name] But the screenshot above doesn’t even include the repo name and it worked fine. To fix this I built my project with
left base href as “/” which fixed the webpage and now it works! It’s quite strange because other people online seem to have the exact opposite problem (they needed to include the base href as their repository name), but my webpage seems to work as intended now. Thanks for the help! |
Beta Was this translation helpful? Give feedback.
-
This is what did it for me. |
Beta Was this translation helpful? Give feedback.
-
Did you set the output path to the folder ‘docs/’ in the file angular.json? Also when you build the project you need to indicate the output path. Sources: |
Beta Was this translation helpful? Give feedback.
-
This is an old issue but I had the same problem and want to help anyone else that comes along later. I solved it using |
Beta Was this translation helpful? Give feedback.
-
Thank you for this solution this really makes a difference! |
Beta Was this translation helpful? Give feedback.
-
I had an exactly the same issue but in ReactJs. I also tested out with an 'test.html' file as mentioned in the comment sections adding it in the root of my git repository. I realized that my custom domain was working as intended. In my case the problem was the homepage address that i configured in my package.json file. The only thing that I had to do was changing the address to this format: 'http://{github ID}.github.io/' ... |
Beta Was this translation helpful? Give feedback.
OKAY GOT IT! Oh my, that took way too long to figure out. I would like to thank @lee-dohm for his suggestion about doing the “test.html” and double checking that my domain configuration was setting up correctly, it helped me figure out what was the problem with the blank page showing.
What I did to fix the blank page :
So for deploying to Github Pages I was following the Angular documentation shown below
This one and a bunch of other tutorials pretty much had the same concept, but after checking the “Network” status from the “test.html” file (that @lee-dohm mentioned) I was looking at how it was requesting the URL.
I realised that everytime the request was get…