Ionic4 dynamic urls


#1

With Ionic4 and Angular Router, should a first time visitor be able to reach a url like:
https://myionic4app.com/item/10002

If I build --prod an app and put it on the server (www folder), and I go to the root of the domain everything works.
If I go via a link like the example url above directly, it does not.

Does not work with service workers installed either.

Is still a Beta problem, special to me or do I need plan for a first-time landing solution?

Surely we are not supposed to use a third, like branch…?

Ionic Info:
ionic (Ionic CLI) : 4.2.1
Ionic Framework : @ionic/angular 4.0.0-beta.13
@angular-devkit/build-angular : 0.10.3
@angular-devkit/schematics : 7.0.3
@angular/cli : 7.0.3
@ionic/angular-toolkit : 1.0.0


#2

So, I thought this would be something that worked right out of the box.
Not looking like it.
Glad to hear otherwise but in the meanwhile, this is working for me - although needs more testing.

I am running Nginx and I use this location redirect:

location / {
    try_files $uri $uri/ /index.html =404;
}

This is loading the dynamic urls complete with parameters.

I should note that 404s are essentially disabled on this site with this - except for the index.html itself.


#3

Ran into the same issue with IIS. check out angular’s deployment section within their documentation.


#4

For those further interested, here is a link to the docs Daniel mentioned:
Angular Deployment

And for my case (Nginx):
Nginx: use try_files , as described in Front Controller Pattern Web Apps, modified to serve index.html :

content_copytry_files $uri $uri/ /index.html;