I have deployed an Angular2 application on an AWS server with Bitnami image.
The application is served by Apache (configured with a virtual host on port 8080) and works fine as long as I start from index.html. If I want to access a different page (which has been configured in the RouteConfig) I get a 404 not found error.
Here is the configuration of the virtual server:
Listen 8080
<VirtualHost _default_:8080>
DocumentRoot "/opt/bitnami/apps/MyApp"
<Directory "/opt/bitnami/apps/MyApp">
Options All
Require all granted
</Directory>
</VirtualHost>
Add .htaccess file to your root folder. I'm using this:
# BEGIN ServeStatic
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
# END ServeStatic
it serves index.html for all requests that would cause 404...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With