Search code examples
urltuckey-urlrewrite-filter

How to forward/redirect only the root of a url using tuckey?


Using Tuckey, if I only wanted to forward /abc to /xyz.html but leave /abc/def or anything else alone, how would I do that?

Basically only /abc itself should be redirected, and any pages under /abc are uneffected.


Solution

  • Just define explicit end of you path with regexp in your <from> element.

    For example

    <urlrewrite>
    
        <rule match-type="regex">
            <condition type="method">GET</condition>
            <from>^/abc$</from>
            <to type="redirect">/xyz.html</to>
        </rule>
    
    </urlrewrite>
    

    So this will redirect only /abc (well also /abc/) to the target /xyz.html URL, the rest will not be matched therefore will not he handled.