'How to decode url on apache for Flutter Web?

I deployed my Flutter web app to an apache server. Flutter adds /#/ just after the base path for all paths. It all works fine. But I need to handle a redirect url that converts /#/ into /%23/. So url comes as /basepath/%23/somePath/. Flutter app doesn't recognize this link so it doesn't start. That's why I'm getting 404 not found. Somehow I need to convert it to /basepath/#/somePath/ format on the go. I tried to add some RewriteRule to .htaccess but it didn't do anything.

Here is the .htaccess file I created to solve this.

RewriteEngine On RewriteRule ^/?basepath/(.*?)/ ${unesc:$1} [R,L,NE,NC]

I'm not very familiar with apache. So any help is appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source