Skip to content

Instantly share code, notes, and snippets.

@VaLeXaR
Last active April 8, 2018 02:47
Show Gist options
  • Save VaLeXaR/72886e5353e4a2daebae36b6a57dcd23 to your computer and use it in GitHub Desktop.
Save VaLeXaR/72886e5353e4a2daebae36b6a57dcd23 to your computer and use it in GitHub Desktop.
Fix http host port for Wordpress #tags: WordPress
<?php
add_action('init', function () {
if(!empty($_SERVER['HTTP_HOST']) && substr($_SERVER['HTTP_HOST'],-3)==':80')
$_SERVER['HTTP_HOST'] = substr($_SERVER['HTTP_HOST'],0,-3);
if(!empty($_SERVER['HTTP_X_FORWARDED_HOST']) && substr($_SERVER['HTTP_X_FORWARDED_HOST'],-3)==':80')
$_SERVER['HTTP_X_FORWARDED_HOST'] = substr($_SERVER['HTTP_X_FORWARDED_HOST'],0,-3);
}, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment