I would like to redirect any URL path that is having a /test to https://localhost/test. Also, if an url is /test?user=123 it has to be redirected to https://localhost/test?user=123 or rather if the url is /test/test_db/user?id=123&pwd=123 has to be redirected to https://localhost/test/user/test_db/user?id=123&pwd=123
All other requests of any kind has to be redirected to a html page that says "Access denied" in the root folder(http://localhost/accessdenied.html).
How do I achieve this with RedirectMatch in apache. I tried something like
RedirectMatch permanent ^test/(.*)$ https://localhost/test/$1
Which did not work.