PWA Routing Problem with RouteReuseStrategy

Hi everyone!

I am developing Capacitor based Ionic application. I built this app for pwa then I published to my server. However, when I try to access any page with definite URL (like: example.com/page/parameter), server responds 404 Not Found error, but I can reach any page inside app. I think a couple of configuration missing in any config file but I could not find anything. My app uses RouteReuseStrategy with IonicRouteStrategy as default.

Actually I would like to post screenshot maybe rendering of 404 page can help anyone to find out reason or solution.

Thanks in advance.

This sounds more like an Angular issue than a Capacitor (since it’s routing based and you mention IonicRouteStrategy). Can you share some code? Thanks

1 Like

Hello, I am sorry for late reply. Thank you for your vision. You are right, it is an Angular issue. I found a solution but I would like to ask whether there is a better one.

I was using routing strategy below in app.module as part of providers:

{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }

After your answer, I changed my route strategy to default one of Angular:

{provide: LocationStrategy, useClass: HashLocationStrategy}

My problem was solved in this way, and most of present things work properly. However, when router.navigateByURL() method is used, Ionic page transitions do not appear and if a page navigates to itself with different url parameter, ion-back-button does not work properly.

Thank you.

When I migrated to 4, I experienced your same issues of things not working correctly. I did not make any modifications to the project as far as routing is concerned. I was able to find the solution by reading the Deployment section of Angular’s docs. Might there be an issue with url rewriting?

Same issue here , Same issue here ,