Created
November 29, 2024 02:17
-
-
Save unfulvio/53242fa491aec74869ef369ea8fe5d10 to your computer and use it in GitHub Desktop.
Setting up ngrok with Valet for WordPress use
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# note this uses `ngrok` directly opposite `valet share` | |
# the `-host-header` param is essential and you can also configure that in `~/ngrok2/ngrok.yml` eventually | |
# in which case it should work also by simply calling `valet share` from the parked site root | |
ngrok http --host-header=rewrite https://your-valet-url.test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// insert these lines at the beginning of wp-config.php | |
if ( isset( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ) { | |
$url = $_SERVER['HTTP_X_FORWARDED_HOST']; | |
} elseif ( ! empty( $_SERVER['HTTP_HOST'] ) ) { | |
$url = $_SERVER['HTTP_HOST']; | |
} else { | |
$url = 'https://your-valet-url.test'; // this fallback should not be necessary | |
} | |
define( 'WP_HOME', 'https://' . $url ); | |
define( 'WP_SITEURL', WP_HOME ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment