I'm setting up an Angular web application with routing : https://wei.insa-cvl.org
When I use the links inside this application, I can open the different pages. For example, clicking on the "Mot de passe oublié ?" link brings me to the good page : https://wei.insa-cvl.org/auth/forgot-password. However, when I try to access this page through the URL, I get an internal server error.
I think the problem comes from the .htacess
file, but even if I remove it, I'm always getting this error.
The .htaccess
file (source:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
RewriteRule ^ /index.html
</IfModule>
The routing :
{path: '', component: ApplicationComponent, canActivate: [AuthGuardService]},
{path: 'auth', component: AuthComponent},
{path: 'auth/forgot-password', component: ForgotPasswordComponent}
...
{path: '**', redirectTo: '/auth', pathMatch: 'full'}
I would like to access the pages through the URL and not only by clicking on the 'in-app links'. Is it possible ?
EDIT : Hurray I finally found a solution ! I had to add {useHash: true}
to my app-routing.module.ts
and using the hash URL, like this one : https://wei.insa-cvl.org/#/policy
But I don't understand, why ??