Reputation: 1003
I have been trying to deploy my Angular 7 application to HTTPD Apache 2 Server. These are the steps I have taken:
Created and configured .htaccess as instructed here:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
Configured my app-routing.module.ts like this:
imports: [RouterModule.forRoot(routes ,{onSameUrlNavigation: 'reload'})]
My main page works but when I try to navigate through other routes e.g. http://myhostname/users/crud, it won't work anymore. Is there something I have missed here?
Thanks.
Upvotes: 0
Views: 1227
Reputation: 11
Build --> ng build --prod --baseHref=/users/crud/
instead of
Build --> ng build --prod
Try the above code. That code work for me.
Upvotes: 1