Last active
October 29, 2018 08:24
-
-
Save PatelUtkarsh/1d912162638fc87e1b0827734c412379 to your computer and use it in GitHub Desktop.
Valet share url fix for WordPress with https support
This file contains 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 | |
/** | |
* 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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Above comment is not working anymore, Use
valet unsecure && valet share