[Ionic4] Deeplink not working in production

Hey guys, I am facing an issue with deeplinks (Angular router). They work perfectly when I run ionic serve . However, when I run ionic build and then serve the www folder with either nginx on my vps, or with the serve npm module in local, deeplinks dont work. Indeed, if i try to reach /mypage manually it throws 404 error.

Do you guys have any idea why this is not working ?

EDIT: solved thanks to mhatington’s answer. For those who wonder how to do that on nginx, I added this line :
try_files $uri $uri/ /index.html;

Depending on the setup you have, you need to rewrite urls to support path-based routing.

https://angular.io/guide/router#appendix-locationstrategy-and-browser-url-styles

For this to work you need to configure your server to redirect any urls to load index.html.
So for my app, I use this with firebase hosting

1 Like

Wow thank you very much that works indeed !