Ideal secure and performant htaccess for running an Angular application (no SSR) on Apache.
This .htaccess file not only delivers your Angular application on Apache, but makes sure you get protected against malicious bots and different other hacking attacks. It also cares about performance by adding relevant caching headers, gzip and more. Make sure you have the relevant apache modules installed on your server. It is even prepared to add a prerender service like prerender.cloud or prerender.io.
Kudos go to:
- Scott Helme (securityheaders.com)
- Jim Walker (HackRepair.com)
- Jeff Starr (perishablepress.com)
- Julian Pömp (github.com/julianpoemp)