title: How to override some function in wordpress
body: <p>I have my wordpress setup on IIS and it is rewritten. Because of that I found some probably bug in wordpress in <code>wp_includes/canonical.php</code> file.
  I think that when I update my wordpress that all my changes will disapear. I can't wait for wordpress fix this (I don't even know if it is bug or how to report one) because that "bug" causes my homepage to go in redirect loop.
   I made some change in <code>redirect_canonical</code> function in that file specificly this change:</p>
  
  <pre><code>function redirect_canonical( $requested_url = null, $do_redirect = true ) {
  ///some other code 
  if ( ! $requested_url &amp;&amp; isset( $_SERVER['HTTP_HOST'] ) ) {
          // build the URL in the address bar
          $requested_url  = is_ssl() ? 'https://' : 'http://';
          //$requested_url=$_SERVER['HTTP_HOST'] //I deleted this because my URL is rewritten 
      $asParts = parse_url( $sURL ); // PHP function
          $requested_url .= $asParts['host'] ;
          $requested_url .= $_SERVER['REQUEST_URI'];
  </code></pre>
  
  <p>How to make this change resistant to wordpress updates?</p>