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.
@realshoaib what does your .htaccess look like?
Do you know the .htaccess template from HTML Boilerplate? There is a section for caching. You can find it here:
https://github.com/h5bp/server-configs-apache/blob/a5893aa05178bf395099f8df1e7ef1a97eb5a924/dist/.htaccess#L1090
If you want to apply caching to specific files or folders, you can wrap it with
<FilesMatch ...>
the similar way I do in order to prevent Browser caching:In my case I prevent ressources from caching in order to force retrieving ressources from the server on every page reload. In your case you coud combine the caching by mime type with the FilesMatch tag, in order to cache ressource from a specific URI.