Created
March 7, 2017 21:09
-
-
Save wernersmit/5ba1f2a96d7ee8d8d7094f04539960ed to your computer and use it in GitHub Desktop.
Fix WP-Admin redirect loop after enabling SSL / HTTPS.
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 | |
/* | |
* Source: http://wordpress.stackexchange.com/a/220896 | |
* Used behind a varnish / nginx reverse proxy setup. | |
*/ | |
/** SSL */ | |
define('FORCE_SSL_ADMIN', true); | |
// in some setups HTTP_X_FORWARDED_PROTO might contain | |
// a comma-separated list e.g. http,https | |
// so check for https existence | |
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) | |
$_SERVER['HTTPS']='on'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment