Im trying this too on my site under the folder forum.
If you can see here on bbpress the code works that way in my case
https://bbpress.org/wp-login.php?action=logout&_wpnonce=fa9b4484b8&redirect_to=https%3A%2F%2Fbbpress.org%2Fforums%2Ftopic%2Flogout-shortcode%2F%3Floggedout%3Dtrue
So my guess is that you can create a custom php for example http://www.mysite.com/logout which will redirect on a file like wp-login.php which will fetch the id from the user and then will do the redirect to the page you want.
its really simple to achieve this type of thing , use a plugin like this
wordpress.org/plugins/log-out-shortcode/
the plugin basically uses some code already in WordPress that you can use.
codex.wordpress.org/Function_Reference/wp_logout_url