title: WP preg_match and REQUEST_URI
body: <p>I am writing a very small wordpress plugin but I seem to be having issues on using it. The <strong>add_action('template_redirect', 'example_function');</strong> works as it should be and the function is called correctly.</p>
  
  <p>The line that is not working is: <strong>if(preg_match('#^/api/(.*)$#', $_SERVER['REQUEST_URI'], $match)) {</strong> The /api/ part and the ^/ are wrong.</p>
  
  <p>Can somebody help me fixing my line? Thank you.</p>