0

I have a website that just went live yesterday. It's built with an Angular backend and a Bulma html framework. I use Google Domains to get a custom domain name, and Git Pages to host my site (from a master /docs repo folder). Besides the usual 5 hours of bug fixing from getting it live, It's going pretty ok. However, I realized that the routing for the site is not going exactly as I want it to go.

My domain is 'myname.net', which is the custom domain in GitPages. In Google Domains, I have two DNS Resource Records: one '@ A pointing to the two IPs of Git Pages (192.30.252.154 and 192.30.252.153)', and the other 'www CNAME pointing to myname.github.io.'

On Git Pages, the source for the website is the master /docs folder, as previously mentioned.

Now to the problem. When I load up my website, instead of going to 'myname.net/home', it goes to 'myname.net/repo-name/home'. Going in between the different pages on the website works fine, but when I try to refresh any page, it instead turns into a blank page. This can only be resolved by going directly to 'myname.net', which gets rerouted to 'myname.net/repo-name/home'.

I have messed with the routing for the page, but that doesn't seem to be fixing anything. For reference, this is an example of the routing:

    const routes: Routes = [
  { path: '', redirectTo: '/home', pathMatch: 'full'},
  { path: 'home', component: TitlepageComponent},
  { path: 'about', component: InfopageComponent},
  { path: 'contact', component: ContactpageComponent},
  { path: 'resume', component: ResumepageComponent}
];

There are more pages, but I think you get the idea. I believe that something is incorrectly set up or configured between git pages, google domains, and the routing of the page itself to cause the 'myname.net' page to automatically redirect to 'myname.net/repo-name/home', which then when refreshed, doesn't have any page that exists, so it returns blank.

Thanks in advance.

  • https://stackoverflow.com/questions/35284988/angular-2-404-error-occur-when-i-refresh-through-the-browser – eko Jun 19 '18 at 14:30
  • Thank you so much! It worked! may I ask what keywords you used to look it up? for future reference. – cricketts Jun 19 '18 at 14:54
  • "angular 404 on page refresh" but I've been using Angular since alpha so I already knew what the problem was (it was bookmarked) :) – eko Jun 19 '18 at 17:33

0 Answers0