Ionic 4 - PWA and navigation

Hello,

I’d like to know why when I go here in my PWA: http://ulisesceca.com the url becomes http://ulisesceca.com/home

but if i try to go directly to http://ulisesceca.com/home by typing it in the browser, it tells me it can’t find that page?

My route code is this:

import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';

const routes: Routes = [
  { path: '', redirectTo: '/home', pathMatch: 'full' },
  { path: 'home', loadChildren: './home/home.module#HomePageModule' },
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
  ],
  exports: [RouterModule]
})
export class AppRoutingModule { }

Thanks.

You have to rewrite you server urls to serve all (or just some) request to index.html

You server have no idea /home is related to the Ionic app

1 Like

How can that be done?

Okay I’ve found out that if you create a home folder in the www and paste the index there it works. Isn’t there some better way?

Depends on your server. Here is instructions for Firebase hosting: https://alligator.io/ionic/pwas/