I created a new htaccess generator for angular apps that makes it easier for you to create the optimal htaccess file: https://julianpoemp.github.io/ngx-htaccess-generator/
The goal of this generator is to create the optimal .htaccess file for Angular apps easily. By default the generator creates an .htaccess file that solves the route redirection issue. To make it easier for you I created a kind of interview mode with some questions. As an additional feature the generator supports adding exclusions for example if you have installed a blog in a subdirectory of your web application and more!
The generator 😁: https://julianpoemp.github.io/ngx-htaccess-generator/
The project: https://github.com/julianpoemp/ngx-htaccess-generator
Place for issues and bug reports: https://github.com/julianpoemp/ngx-htaccess-generator/issues
If you have questions you can comment below. Please report bugs here.
Hi everyone and @julianpoemp. I need help regarding implementing the .htaccess file in my angular project which doesn't have the backend integration yet at all. That is why i can't make http headers to send the 'Cache-Control' header as i want it to. Like currently I'm working on the lighthouse optimization of the project where I need to cache the cacheable resources like images stylesheets and scripts in order to reduce round trip to the server again & again. Currently I'm getting 70+ resources that needs to be cached but I can't cache each single one seperately, so I decided to go with .htaccess way so that simply defining in one place and getting effect everywhere. The problem is, despite placing .htaccess file in root directory, I'm unable to see the desired effect i.e. cache control header is vanished.
Kindly help, Thanks in advance.