Wildcards

Here we describe how yo can use wildcards in revIgniter URI Routing.

A typical wildcard route might look something like this:

put "catalog/productLookup" into gRoute[2]["product/:num"]

In a route, the array key contains the URI to be matched, while the array value contains the destination it should be re-routed to.

In the above example, if the literal word "product" is found in the first segment of the URL, and a number is found in the second segment, the "catalog" controller and the "productLookup" handler are instead used.

You can match literal values or you can use two wildcard types:

:num :any

* :num will match a segment containing only numbers. * :any will match a segment containing any character.

Note: The gRoute array must be numbered and the key number for reserved routes must be 1. So, the keys of your custom routes must start with 2 as in the example above. Routes will run in the order of the keys of the gRoutes array. Routes with lower key numbers will always take precedence over those with higher ones.