title: str_replace and preg_replace work on one server but not another
body: <p>UPDATE: As it turns out, the below is caused by a caching issue on my production server. Thanks to everybody who contributed thoughtful answers.</p>
  
  <p>I have a simple function on a php page that takes a url such as:</p>
  
  <p><a href="http://myurl.com/mypage.html?param1=value1" rel="nofollow noreferrer">http://myurl.com/mypage.html?param1=value1</a></p>
  
  <p>and converts it to:</p>
  
  <p><a href="http://myurl.com/searchpage.html?param1=value1" rel="nofollow noreferrer">http://myurl.com/searchpage.html?param1=value1</a></p>
  
  <p>All it does it swap out the page.html portion.</p>
  
  <p>To do this, I use the following:</p>
  
  <pre>
  $currentUrl = $this->getCurrentUrl(); // Grabs the current url, i.e 'http://myurl.com/mypage.html?param1=value1'
  
  // Derive a search pattern from the current url
  $pattern = "/" . str_replace(array("/", ".", "-"), array("\\/", "\\.", "\\-"), $currentUrl) . "/";
  
  // get rid of the 'mypage.html'
  $newUrl = preg_replace($pattern, 'http://myurl.com/', $currentUrl);
  
  // replace the question mark with the correct page
  $newUrl = str_replace("/?", "/searchpage.html?", $newUrl);
  </pre>
  
  <p>The above code is not the exact code but is a good representation. It works beautifully on one server, but when I push to production, the preg_replace does not work. I originally attempted to use str_replace. It also works on my local development machine, but not on the production server.</p>
  
  <p>I have confirmed that the URL variables are coming in correctly. Any ideas?</p>