I am using AEM 188.8.131.52. To achieve URL shortening I used Apache Sling resource resolver factory and it works fine. Now at apache, the cache is persisted with shortened paths as /en/home.html, /en/home/page1.html etc.
This disturbs flush agents as when /content/myapp/en/home is published, corresponding path is not found in apache and no flushing happens. This makes /en/home.html obsolete.
One solution i got to fix this issue is apache rewrite rules in httpd.conf file. If i add the rewrite rules so i dont need to add the rewrite rules in Apache Sling resource resolver factory am i right? Or do we have any other way to fix this issue other than apache rewrite rules.
Write a custom flush agent to do what 'ACS Dispatcher Flush Rules' does. In fact, you could reuse the source code per your requirements. The approach is to manipulate the flush path to achieve what you want to do
There is a flag in replication/flush agents as 'Alias Update'. When it is turned on, it flushes the vanity urls configured in page properties as sling:vanity. I'm not sure if it would work with resource resolver but you can try or borrow this feature.
Custom rewrite rules in apache that you already tried/tested.