title: My Tomcat rewrite rule not working and I don't know why
body: <p>I cannot troubleshoot the rewrite rule, please help to find the missing peace.</p>
  
  <p>The regex seems to be fine, as I tested replacement in Notepad++.</p>
  
  <p>Source URL is:
      <a href="http://qf.myserver.com:8080/archive?get&amp;pVersion=0045&amp;contRep=T1&amp;docId=F40343A990B01ED8BAF97A695626C259&amp;ixUser=QFNCOTAAP001&amp;ixAppl=libdsh&amp;accessMode=r&amp;authId=QFNCOTAAP001&amp;expiration=20181219153855&amp;secKey=MIIBXAYJKoZIhvcNAQcCo" rel="nofollow noreferrer">http://qf.myserver.com:8080/archive?get&amp;pVersion=0045&amp;contRep=T1&amp;docId=F40343A990B01ED8BAF97A695626C259&amp;ixUser=QFNCOTAAP001&amp;ixAppl=libdsh&amp;accessMode=r&amp;authId=QFNCOTAAP001&amp;expiration=20181219153855&amp;secKey=MIIBXAYJKoZIhvcNAQcCo</a></p>
  
  <p>Target URL is:
       <a href="http://qf.myserver.com:8080/archive?get&amp;pVersion=0045&amp;contRep=T1&amp;docId=F40343A990B01ED8BAF97A695626C259&amp;ixUser=QFNCOTAAP001&amp;ixAppl=libdsh&amp;accessMode=r&amp;authId=QFNCOTAAP001" rel="nofollow noreferrer">http://qf.myserver.com:8080/archive?get&amp;pVersion=0045&amp;contRep=T1&amp;docId=F40343A990B01ED8BAF97A695626C259&amp;ixUser=QFNCOTAAP001&amp;ixAppl=libdsh&amp;accessMode=r&amp;authId=QFNCOTAAP001</a></p>
  
  <p>The RewriteCond should check for links which contain 'archive?get' and '&amp;contRep=T1' and the remove everything from the URL backwards including and after &amp;expiration...</p>
  
  <pre><code>context.xml
  &lt;Context&gt;
  &lt;Valve className="org.apache.catalina.valves.rewrite.RewriteValve" /&gt;
  &lt;/Context&gt;
  
  in \WEB-INF\rewrite.config and \conf\Catalina\localhost\rewrite.config:
  
  RewriteCond     %{REQUEST_URI}      (archive\?get.*)(\&amp;contRep=T1.*)
  RewriteRule     ^(.*).expiration.*      $1
  </code></pre>
  
  <p>It does not replace the URL, Tomcat still executes the source URL.</p>