Deployment | Starting Ionic routing after https://my.url.com/versionNumber

I have done an Ionic 4 app. The aim is to use it as website for mobile.
To do that I put my www folder (built thanks to the ionic build --prod --service-worker command) on a server.

I am at the stage of deploying the app in a folder on the server, which name corresponds to the app version. That way, we can check and confirm that the new version is correct and then switch to the default version.

For instance :
https://my.url.com/v0.2 → goes to the new app version v0.2
But https://my.url.com → goes to the default app version v0.1
(thanks to ngsw-config.json I don’t have to specify the index.html file)

As you probably know, Ionic routing deleted everything after the .com and takes in the default version rather that the version specified in the URL: The built files is requested at https://my.url.com/ and not at https://my.url.com/v0.2.

The only article that refers more or less to my issue is :

Another solution is to separate the S3’s root folders into versions. And upload them by versions. Once uploaded you have to fix CloudFront’s distribution Origin Path to the correct version.
https://medium.com/@peatiscoding/here-is-how-easy-it-is-to-deploy-an-angular-spa-single-page-app-as-a-static-website-using-s3-and-6aa446db38ef

The solution that is suggested in this article is to add a default path, but it’s not what I want to do.
I also tried to configure navigationUrls in ngsw-config.json, unsuccessfully :frowning: .

How can I configure my project so my app’s built files redirect to the version specified in the URL and NOT the default version?
That is to say, how can I make Ionic routing start after v0.2 (https://my.url.com/v0.2)

Thanks a lot for your help !

1 Like

Hi

I got the same problem concerning deployment of my app (for info, my app is hosted in a S3 bucket on AWS) !

I hope we can find someone in the @ionic_team who can help us :sunny: .

Thanks,
C

1 Like

I found the response https://stackoverflow.com/questions/38112891/angular-2-4-5-set-base-href-dynamically/41949470 ! Have a nice day

1 Like