Looks like in Joomla there is a better way to solve this issue than using mod_rewrite. A big advantage seems to be that you do not have to rely only on the Apache server, i.e. if you want to use nginx.

Here some links I found on how to write a Custom Router in Joomla:

For Joomla 4

 - [https://www.dionysopoulos.me/book/com-router.html][1]
 - [https://youtu.be/zqyjRuVaT8M][2]
 - [https://joomla.stackexchange.com/questions/31515/router-for-joomla-4][3]

For Joomla 3

 - [https://docs.joomla.org/J3.x:Supporting_SEF_URLs_in_your_component][4]

If you know of better tutorials, feel free to post your links to this topic.

  [1]: https://www.dionysopoulos.me/book/com-router.html
  [2]: https://youtu.be/zqyjRuVaT8M
  [3]: https://joomla.stackexchange.com/questions/31515/router-for-joomla-4
  [4]: https://docs.joomla.org/J3.x:Supporting_SEF_URLs_in_your_component

Edit:
This thread should also be helpful:
https://joomla.stackexchange.com/questions/33319/joomla-4-router-forward-to-controller-function