'I'm getting the wrong requested url (404 Not Found), when I add a custom domain , my setup must be wrong ?
I deployed my website created with (create-react-app) on GitHub-pages.
I have a custom google domain that I added in Github-pages
I added a CNAME and followed all the instructions
Now: 1 - If I don't use a Custom Domain I can Access my website and it works if I go to : https://myAccount.github.io/MyWebsite/#/
2- If I Add a custom domain, Github says everything is fine (see Attached picture 1 )
3- Once I add the Custom domain and I try to access my new Website I get these errors :
main.12d12fef.css Failed to load resource: the server responded with a status of 404 (Not Found)
main.56dc6c7d.js Failed to load resource: the server responded with a status of 404 (Not Found)
4- If I check the console (Network tab) there is something wrong (I suspect it's the issue), The requested URL seems wrong (doubled) :
http://www.MyWebsite.com/MyWebsite/static/js/main.89dc2c1d.js
5- which is the reason why nothing is found (404)
6- If I remove the Double and try to access :
http://www.MyWebsite.com/static/js/main.89dc2c1d.js
I can see the minified code
Question : Why is the requested URL wrong ? Why is it Doubled ?
http://www.MyWebsite.com/MyWebsite/static/js/main.89dc2c1d.js
How Can I fix this ?
Solution 1:[1]
Alright, I found the problem:
The issue was in my package.json, on the homepage key
I initially had,
"homepage": "https://myGithubAccount.github.io/myWebsite"I should have put instead:
"homepage": "https://myWebsite.com"
The issue has been resolved now by doing this modification
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | AziCode |

