Conditons

Conditional Redirect contains a highly configurable condition engine capable of evaluating single conditions or multiple conditions within a single Conditional Redirect attribute and even evaluating multiple  Conditional Redirect attributes.

Multiple Conditions

Conditional Redirect is pre-configured for up to 5 conditions within a single Conditional Redirect attribute.

This number of conditions can be configured in application/config/ at jl_conditional_redirect.condition_engine.max_conditions

Multiple conditions are either all OR or all AND.

Multiple Attributes

Conditional Redirect is pre-configured for a single attribute. The processing of multiple attributes can be configured at jl_conditional_redirect.conditional_redirect_mode which can have the values single_attribute (default) or multi_attribute.

When multi_attribute is configured, all Conditional Redirect attributes for a page are executed in alphabetical sequence. The first redirect ends that sequence. This should not be configured unless you actually need it as it presents an overhead for all pages, not just those with the attribute.

Page Cache

Page caching could have unexpected consequences for evaluation of Conditional Redirect. If in doubt about whether a condition evaluation could be skewed by the page cache, the page cache is best disabled for any pages using one or more Conditional Redirect attributes.

You can leave the page cache enabled for other pages.

Conditional Redirect Operators

  • Comparisons
    • < LT
    • <= LE
    • = EQ
    • != NE
    • >= GE
    • > GT
  • Numeric length
    • < LT # characters
    • <= LE # characters
    • = EQ # characters
    • != NE # characters
    • >= GE # characters
    • > GT # characters
  • Length comparisons
    • < LT string lengths
    • <= LE string lengths
    • = EQ string lengths
    • != NE string lengths
    • >= GE string lengths
    • > GT string lengths
  • Patterns
    • Text contains
    • Match, with *? wildcards
  • Special
    • Is empty
    • Is not empty
  • Fixed
    • True always
    • False always

Comparison modes

  • Case sensitive
  • Case invariant
  • Numeric

Relational options

  • end
  • AND
  • OR

Condition value placeholders

Values may contain {{place holders}}. A place holder is identified by being wrapped in double moustaches {{...}}.

A {{place_holder}} follows the format category:key|default. Only the key is required. The other parts are optional.
  • category - optional prefix of query, user, page, visitor, which identifies where to find the key. If not specified, the default category is query.
  • key - identifies what to fill, such as a query parameter name, a user or page property or attribute.
  • default - an optional default value should the key not be filled. If not specified, an un-filled key will remain.

The query category is actual query data. When a category is not specified, this category is defaulted. Keys are the query key names:
  • all - serialized json for all query keys.
  • key - any key matching query key returns the value of that key.

page category:
  • name - page name.
  • description - page description.
  • url - page url.
  • id - page/collection id.
  • attribute_handle - page attribute value.

user category:
  • email - current user email.
  • name - current user name.
  • url - current user profile url.
  • id - current user id.
  • attribute_handle - current user attribute value.

The visitor category provides information about the visitor and browser:
  • ip - IP address string.
  • country - Country code.
  • continent - Continent code.
  • state - State/Province code (accuracy can vary greatly by country and may not be available for all countries).
  • city - City (accuracy can vary greatly by country and may not be available for all countries).
  • locale - Browser locale.
  • locales - Possible browser locales in decreasing priority.
  • browser - Browser user agent string.

The date category, formatted using php DateTime:
  • timestamp - System timestamp, seconds since 1 January 1970.
  • date - Date formatted Y-m-d.
  • time - Time formatted H:i:s.
  • datetime - Date and Time formatted Y-m-d H:i:s.
  • format-string - DateTime formatted according to the format-string.

The random category generates random values:
  • 10 - any number provides a random string of that length.
  • d10 - d or D followed by any number provides a random number of that length.
  • g10 - g or G followed by a number assigns to one of that number of groups. This is based on ip address, so is constant.

Some examples:
  • {{query:my_input}} - the query category and query key my_input.
  • {{my_input}} - the query key my_input (defaults to the query category).
  • {{visitor:country}} - the visitor category and the country detected from their IP address.
  • {{user:name|Guest}} - the user category and property name with a default of Guest.
  • {{random:G3}} - the visitor is assigned to one of 3 groups numbered 1..3 derived from their ip address.
  • {{page:tags}} - the page category and attribute tags.

Additional Pages

Conditional Redirect in not a substitute for page permission. If you need genuine security, require users to register and login and use page permission to determine what pages they can see.