I know a lot of people ask this, but I have looked at all the answers and nothing is working.
I am sure the problem is I need to create a .htaccess file and add it to my dist because that is what the ISP console guide says to do.
I am using Angular cli and the build command:
ng build --aot --prod --base-href ./
I have added this .htaccess file to my app folder - the same folder as my index.html file. This is the .htaccess code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /index.html [NC,L]
I tried various snippets from various different answers on SO, I tried the snippet on the angular.io guide, I tried changing the base-href. Nothing seems to work and I can't even be sure it's being added properly to my dist in the build. What can I do?
After making a big fuss with the technical team of my hosting provider, they confirmed my .htaccess file was not being uploaded via my FTP client. It looks like I should have added it to the dist folder after the build. The code for the .htaccess file they added is just the same as one of the versions I tried before and it works fine:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
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