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; | |
} | |
} |
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
In order for
valet secure
andvalet share
to work togetherdo
valet secure
Edit file at
~/.valet/Nginx/{your_site}
Comment out first block like below
This will not force https but https will work instead of giving you 301 redirect loop.
Ref: laravel/valet#382 (comment)