URL rewrite – rewrite the var request on postname

I'm trying to do a rewrite so that the var request looks pretty:

Here is the URL structure that I have now:

example.com/post_type/post_name/?subpage=about

That's what I want:

example.com/post_type/post_name/about

Please note that after the name changes depending on the site you are on. All the answers I have found so far do not take this into account.

This is my current code:

add_filter (& # 39; query_vars & # 39; function ($ vars) {
$ vars[] = & # 39; subpage & # 39 ;;
return $ vars
});
add_action (& # 39; init), function () {
add_rewrite_tag (% subpage%, & # 39;[^/]+) & # 39;);
add_rewrite_rule (& # 39;[^division/]([^/]+), & # 39; index.php? name = $ matches[1]& subpage = $ matches[2]& # 39; & # 39; Back & # 39;);
});

And yes … I've cleared the rewrite rules after every change made.