Path Based Routing in PWA


#1

We have a progressive web app that will not be compiled for any other platform, and we would like to use real URL paths (no hash). I understand that we need to add the PathLocationStrategy with a base href. It isn’t clear to me whether we need to use DeepLinks or not, however. If we do need to use DeepLinks, the installation line seems to require that we have a fixed domain (–variable DEEPLINK_HOST=example.com). If that is true, how can one use it on both dev and production servers?

I’m familiar with Angular 4 routing, and I know that ionic does not use that, but how does one get routing to work for PWAs?

In any case, adding the path strategy, the base href and the following code does not work:

IonicModule.forRoot(NoctiAppComponent,
            {
                iconMode: 'ios',
                tabsPlacement: 'bottom',
                locationStrategy: 'path'
            },
            {
                links: [
                    {component: GuideContentPageComponent, name: 'Guide', segment: 'guide'},
                ]
            }
        ),

When I go to /guide, the link is preserved on every page, and it seems to have no effect. I have set up the apache server with the following:

                RewriteEngine On
                RewriteBase /
                RewriteRule ^index\.html$ - [L]
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule . /index.html [L]