Using rule sets to transform URLs using-rulesets-to-transform-urls

AEM 6.4 has reached the end of extended support and this documentation is no longer updated. For further details, see our technical support periods. Find the supported versions here.

You can deploy rule sets in Dynamic Media to transform URLs. Rule sets are sets of instructions written in a scripting language (such as JavaScript) that evaluate XML data and take certain actions if that data meets certain conditions. Each rule consists of at least one condition and at least one action. A rule evaluates the XML data against the conditions, and if a condition is met, then it takes the appropriate action. Examples of rule sets include the following:

  • Adding a MIME type suffix. Many services and websites require image suffixes, such as adding .jpg to a URL.

  • Creating a folder path to the URL for SEO (Search Engine Optimization) purposes.

    See How Adobe Dynamic Media Classic Supports SEO.

  • Adding metadata to the URL for SEO (Search Engine Optimization) purposes.

    See How Adobe Dynamic Media Classic Supports SEO.

  • Setting the content disposition to trigger a download.

  • Simplify Image Serving templating URLs for personalization. For example, turn rgb{XX,YY,ZZ} into the RTF-ready \redXX\greenYY\blueZZ

  • Request certain characters to be encoded such as $, {, and }, and certain characters to be decoded toward ImageServer. For example, Facebook does not work well with URLs containing special characters.

    See Removing special characters from URLs.

In the context of Dynamic Media, websites that use an XML-based system to manage asset information can upload XML files to Dynamic Media. You can designate one of these files as the pre-processing rule set file for serving Dynamic Media asset. This file restructures the standard URL protocol format to meet the business logic of systems being integrated with Dynamic Media. You specify an XML file to serve as the rule set definitions file path.

Use caution when using rulesets; they can prevent Dynamic Media content from being displayed on your website.

There are sample rulesets available that can help you create your own ruleset.
See Rule set reference.

As with all rule set creation, ensure that your XML file is valid before you upload it by using an XML validator program such as xmlvalid.
See also Troubleshooting rule sets.

Also, make sure you first test your rule set in a staging environment that does not impact your live production environment.
Production environments and staging environments typically require different logins.

See the Adobe Dynamic Media Classic desktop application for sign in information.

See also Using ‘asset’ instead of ‘is’ image in a rule set.

To deploy XML rule sets:

  1. Sign in to your Dynamic Media Classic desktop application.

    Your credentials and sign in were provided by Adobe at the time of provisioning. If you do not have this information, contact Technical Support.

  2. Upload your rule set file by doing the following:

    • On the Global Navigation bar, click Upload.
    • On the Upload page, near the upper-left corner, click Browse.
    • In the Open dialog box, browse to your rule set file (XML).
    • Select the file, then click Open.
    • On the right side of the Upload page, select a destination folder for the rule set file.
    • Near the bottom of the page, ensure Publish After Uploading is checked.
    • In the bottom right corner of the page, click Submit Upload.
    • On the Global Navigation bar, click Jobs to check the status of the upload job. When the Status column on the Job page says Upload Done, continue to the next steps.
  3. On the navigation bar near the top of the page, click Setup > Application Setup > Publish Setup > Image Server.

  4. On the Image Server Publish page, under the Catalog Management group, locate Rule Set Definition File Path, then click Select.

  5. On the Select Rule Set Definition File (XML) page, browse to your rule set file, then in the lower-right corner of the page, click Select.

  6. In the lower-right corner of the Setup page, click Close.

  7. Run an Image Server Publish job.

    The rule set conditions are applied on the requests to the live Dynamic Media Image Servers.

    If you make changes to the rule set file, the changes are immediately applied when you re-upload and re-publish the updated rule set file.