Rewrite Panel URL for user convenience

I’ve got a project I’m working on where Kirby is just being used as an API an stored in a sub-folder

So currently if a user wants to access the panel the URL would look like this:

mysite.com/api/panel/

but for convenience I’d like to rewrite all panel urls to

mysite.com/admin/

I’ve got the url rewriting to work, but I get the following error when the panel loads

Any suggestions??

I suppose another solution (to avoid a whole lot of rewrites) would be to change the location of the panel folder itself but I’m not sure how to go about that