Redirect all but certain requests to index I have a defined in routes.php a regex that redirects all queries but api to my index template:

return array(
   '&lt;url:(?!api).*&gt;' =&gt; ['template' =&gt; 'index']
);


I'm trying to exclude robots.txt as well as Google Analytics which is utm_source=analytics_test&amp;utm_medium=referral I've tried the following but it's not quite right:

return array(
   '&lt;url:^(?!api|robots|utm_source)(.*)$&gt;' =&gt; ['template' =&gt; 'index']
);
This will redirect all queries but urls containing: 
api or robots or utm_source strings

return array(
   '^(?!.*(api|robots|utm_source)).*$' =&gt; ['template' =&gt; 'index']
);