Created
December 1, 2015 16:21
-
-
Save hideokamoto/a693ab7341cabe1a9452 to your computer and use it in GitHub Desktop.
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 | |
/* | |
Plugin Name: CloudFront Host Fix | |
Plugin URI: | |
Description: CloudFront & Nginx Reverse Proxy Cache fix. | |
Version: 0.1 | |
Author: | |
Author URI: | |
*/ | |
add_action('redirect_canonical', 'change_requested_url'); | |
function change_requested_url($redirect_url, $requested_url) { | |
$redirect_url = is_ssl() ? 'https://' : 'http://'; | |
$redirect_url .= $_SERVER['HTTP_HOST']; | |
$redirect_url .= $_SERVER['REQUEST_URI']; | |
return $redirect_url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment