Implementing on the server side
To utilize this method, it is necessary to perform URL rewriting on the server side. Essentially, all links must be rewritten to direct to the entry point of the application (such as index.html).
The rationale behind this requirement is that when initially accessing a specific page (/deeplink), for example after refreshing the browser, there is no indication to the browser that this is not a valid URL. Subsequently, the browser proceeds with loading the content. However, if the root page and all JavaScript code are already loaded, Angular can intercept the request to /deeplink before it reaches the server, allowing for proper handling.
If you have a .htaccess file, you can follow these steps:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /index.html [NC,L]