Wildcards and Regular Expressions Are Not Supported

There is currently no support for wildcards (for example, *) or regular expression matching syntax in path matches. However, see the sub-dirs-only match, for a special case of declaring a path indirectly.

recursive-dirs

The recursive-dirs match is used to match against a particular path component (directory) and any subdirectories of that path component. If you don’t want to match recursively, you would pair this match with a this-dir match, as explained below. The syntax for this path match is:

<match:recursive-dirs value="dir" nocase="off" include-path-params="off">
</match:recursive-dirs>

The value attribute is the directory name without the leading or following slash (/).

The nocase attribute is a Boolean to specify whether or not the match should be case-sensitive. A setting of “on” makes the match case-insensitive. The default is “off.”

The “include-path-params” attribute is a Boolean to specify whether path parameters should be considered when matching on a path component. By default, the flag is off and the path parameters are ignored during the comparison.

Notice that the match is for a single component of the URI path. You must not combine path components to match a longer portion of the URI path.

That is the following syntax is not allowed:

<match:recursive-dirs value="images/borders">

Although the match value is a single component of the URI path, this does not mean that the component can exist anywhere in the URI and result in a match. A more complete metadata example would look something like this:

<eccu>
    <match:recursive-dirs value="images">
        <revalidate>1046581729</revalidate>
    </match:recursive-dirs>
<eccu>

In the example above the match tag <match:recursive-dirs value="images"> is at the root directory. This match applies to any files that match the URI paths:

www.example.com/images/
www.example.com/images/*/
www.example.com/images/*/*/

Note that it does not apply the revalidate metadata to:

www.example.com/electronics/images/

The metadata example could be expanded to include another subdirectory, which would be specified with a separate tag. The relevant portion of the metadata would look like the following:

<match:recursive-dirs value="images">
    <match:recursive-dirs value="borders">
         <revalidate>1046581729</revalidate>
    </match:recursive-dirs>
</match:recursive-dirs>

The example above applies the <revalidate> tag to all files that match the URI path:

www.example.com/images/borders/
www.example.com/images/borders/*/...

sub-dirs-only

The syntax for this path match is:

<match:sub-dirs-only value="Sub-directories Only">
</match:sub-dirs-only>

This match is used to set metadata for all directories beneath the current directory, but not the current directory. In most cases you will first declare the directory in a separate recursive-dirs match. The exception is when you mean to match on any directory below the root directory.

The following metadata example sets revalidation for all files in any subdirectory of the “images” directory, but not the images directory itself.

<match:recursive-dirs name="images">
    <match:sub-dirs-only" value="Sub-directories Only>
         <revalidate>1046581729</revalidate>
    </match:recursive-dirs>
</match:recursive-dirs>

Nesting sub-dirs-only Matches

It is also possible, though not recommended, to nest sub-dirs-only tags within each other to specify a path that contains no specific component names.

Specifically, you could match any files in directories three levels deep and below, such as these:

www.example.com/anydir/anydir2/anydir3/
www.example.com/images/borders/specials/

and apply <revalidate> with the following metadata:

<match:sub-dirs-only value="Sub-directories Only">
    <match:sub-dirs-only value="Sub-directories Only">
         <match:sub-dirs-only value="Sub-directories Only">
              <revalidate>1046581729</revalidate>
         </match:sub-dirs-only>
    </match:sub-dirs-only>
</match:sub-dirs-only>

Notice that in no case was a directory component specified by name. In this sense, “sub-dirs-only” matches can be interpreted as “*”.

this-dir

This-dir matches restrict the application of metadata to the current path component match rather than applying the metadata to all subdirectories.

The syntax for this path match is:

<match:this-dir value="This Directory Only">
</match:this-dir>

The following metadata example sets revalidation for the images directory but not for any subdirectory of the images directory.

<match:recursive-dirs value="images">
    <match:this-dir value="This Directory Only">
         <revalidate>1046581729</revalidate>
    </match:this-dir>
</match:recursive-dirs>

filename

It is possible to match either a specific file or the default file within a directory. The metadata tags are:

filename value="filename.ext": match an exact file within the current directory

filename value="No File Specified": match the default file within the current directory