Skip to content

Instantly share code, notes, and snippets.

@PatelUtkarsh
Last active October 29, 2018 08:24
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatelUtkarsh/1d912162638fc87e1b0827734c412379 to your computer and use it in GitHub Desktop.
Save PatelUtkarsh/1d912162638fc87e1b0827734c412379 to your computer and use it in GitHub Desktop.
Valet share url fix for WordPress with https support
<?php
/**
* Add this block in wp-config.php file.
*
* Move any other `WP_HOME` or `WP_SITEURL` in else condition if present.
*/
if ( isset( $_SERVER['HTTP_X_ORIGINAL_HOST'] ) ) {
$is_ssl = isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] );
$actual_link = ( $is_ssl ? "https" : "http" ) . "://{$_SERVER[ 'HTTP_X_ORIGINAL_HOST' ]}";
define( 'WP_HOME', $actual_link );
define( 'WP_SITEURL', $actual_link );
if ( $is_ssl ) {
$_SERVER['HTTPS'] = 1;
}
}
@PatelUtkarsh
Copy link
Author

Above comment is not working anymore, Use valet unsecure && valet share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment