Relative instead of absolute links in pages?

There is a filter, post_link, that permalinks pass through before being returned from get_permalink in wp-includes/link-template.php. You can use that filter to alter the links.

However, beware that making all permalinks relative may have unintended consequences in certain contexts, e.g. you might not want relative links when is_feed() == true.

You may find that the post_link filter doesn’t catch all of the URLs you need changed. In that case, you can try the home_url filter which has much broader effect.

Another possibility (my favorite) is to use output buffering to relativize the links. (Example at bottom.)

To be safe, you can change the links only when necessary. I don’t know how you’re getting the content from the actual blog to the static subdomain, but if you’re using HTTP requests you can add a query arg: ?rlz and then look for that in your theme/plugin.

if ( isset($_GET['rlz']) ) {
    function my_ob_handler($HTML) {
        return str_replace( home_url("https://wordpress.stackexchange.com/"), "https://wordpress.stackexchange.com/", $HTML );
    }
    ob_start( 'my_ob_handler' );
}

error code: 523