Old Project URLs redirect for REST API?


I have moved a project’s URL recently, from ‘foo/bar’ to ‘foo/bar/baz’.

When I visit a URL linking to the old project path in the browser,
e.g. https://mygitlaburl.com/foo/bar/-/merge_requests/127, I see an error pop up like:
Project 'foo/bar' was moved to 'foo/bar/baz'. Please update any links and bookmarks that may still have the old path. But I am re-directed to the new project ID with a working URL of https://mygitlaburl.com/foo/bar/baz/-/merge_requests/127

Is there a way to have my REST API calls do the same thing, rather than just return 404 errors?