Search code examples
regexhttp-redirecttuckey-urlrewrite-filter

"Exceptional" rule for Tuckey URL Rewrite Filter


Guys! I'm using Tuckey URL Rewrite Filter and I want all those requests which were not started with "/specialUrl/" being now prefixed with "/prefixUrl/". For example:

  • "/specialUrl/xxx" stands as it is ("/specialUrl/xxx"), but
  • "/otherUrl/xxx" transforms to "/prefixUrl/otherUrl/xxx";
  • "/xxx" also transforms to "/prefixUrl/xxx".

How should I describe such a rule(s)?


Solution

  • You can use this rule:

    <rule match-type="regex">
      <condition name="request-uri" operator="notequal">^/specialUrl/.*$</condition>
      <from>^/(.*)$</from>
      <to type="permanent-redirect">/specialUrl/$1</to>
    </rule>