Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mgussekloo/c682716f9251f6cf44433362ba863c11 to your computer and use it in GitHub Desktop.

Select an option

Save mgussekloo/c682716f9251f6cf44433362ba863c11 to your computer and use it in GitHub Desktop.

Revisions

  1. mgussekloo created this gist Jun 20, 2024.
    18 changes: 18 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    <?php
    // phpcs:ignoreFile

    define( 'EXPOSED_DOMAIN', 'xxx.sharedwithexpose.com' );
    define( 'REAL_DOMAIN', 'mydomain.test' );

    // Load only if we are running under Expose.
    if ( empty( $_SERVER['HTTP_X_ORIGINAL_HOST'] ) || strpos($_SERVER['HTTP_X_ORIGINAL_HOST'], EXPOSED_DOMAIN) === false) {
    return;
    }

    ob_start(function($buffer) {
    return str_replace(REAL_DOMAIN, EXPOSED_DOMAIN, $buffer);
    });

    add_action('shutdown', function() {
    ob_end_flush();
    });