Ionic 4 - this.location.back() going back to root page

When going forward a page I use this:

  navigateTo(page: string = '', replace: boolean = false) {
    this.router.navigate([page], { replaceUrl: replace });

ReplaceUrl is set when I don’t want the user to be able to go back a page using the back button, e.g. Redirecting to the home page after logging in.

I’m having trouble going back a page when entering a number of pages. As mentioned, I login first which then redirects to the home page and I go through a couple of pages.

Home => List Page => List Page => Detail Page

  navigateBack() {

I have this function being called. An example, if on the detail page if I click save(). After it saves to the DB, it calls that function to go back a page so it’s back to the list page but occasionally it goes back all the way to the home page, sometimes it actually goes back to the previous page and sometimes it doesn’t even go back at all. I’m not sure what I’m doing wrong.

I’d really appreciate your help and advice. Also, navigating forwards a page, is the way that I do it ok?