Skip to content

Instantly share code, notes, and snippets.

@pappu687
Created November 16, 2020 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pappu687/ae5d4eaf0cee2627b9ac16d440efd3f0 to your computer and use it in GitHub Desktop.
Save pappu687/ae5d4eaf0cee2627b9ac16d440efd3f0 to your computer and use it in GitHub Desktop.
WP-CONFIG modifications for Wordpress sites behind EC2 Application Load Balancer. Fixes the redirect loop when trying to access /wp-admin
<?php
define('FORCE_SSL_ADMIN', true);
if ( (isset($_SERVER['HTTP_X_FORWARDED_PORT'] ) && ( '443' == $_SERVER['HTTP_X_FORWARDED_PORT'] ))
|| (isset($_SERVER['HTTP_CF_VISITOR']) && $_SERVER['HTTP_CF_VISITOR'] == '{"scheme":"https"}')) {
$_SERVER['HTTPS'] = 'on';
}
/**
* Rest of the wp-config.php below.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment