Skip to content

Instantly share code, notes, and snippets.

@rwaddin
Last active September 4, 2020 07:09
Show Gist options
  • Save rwaddin/0b0e8349a1c2f87f774718406d9d2ec0 to your computer and use it in GitHub Desktop.
Save rwaddin/0b0e8349a1c2f87f774718406d9d2ec0 to your computer and use it in GitHub Desktop.
<?php
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on"){
$config['base_url'] = "https://".$_SERVER['HTTP_HOST'];
}else{
$httphost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : "";
if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https"){
$config['base_url'] = "https://".$httphost;
}else{
$config['base_url'] = "http://".$httphost;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment