CQ5.x : Alternative To Vanity URL

Symptoms

There are a few issues with vanity URL that do not meet your requirements -- specifically (1) centralized control over the vanity URL and (2) underscore character in the name of the path is not supported. Is there a work around for these?

Cause

The vanity URL field is currently associated with each page and management become extremely difficult. This localized control of vanity URL can be removed by remove the vanity URL field.

In addition, there is a bug the code the handle Vanity URL in which underscore are not allowed. A fix is currently being worked on by R&D in future release of CQ.

Resolution

As an alternative to vanity URL, the Sling /etc/map can be used to provide similar functionality to vanity URL. An example /etc/map has been provided to show such functionality. In the example, requesting the page  http://<host>:<port>/content/geometrixx/en/civil_justice.html will return the page http://<host>:<port>/content/geometrixx/en/law-and-business.html .

The structure of /etc/map is as follows:

/etc [sling:Folder]
   /map [sling:Folder]
      /http [sling:OrderedFolder]
         /civil_justice [sling:Mapping]
            - sling:internalRedirect="[/content/geometrixx/en/law-and-business.html]"
            - sling:match="\[^/]+/content/geometrixx/en/civil_justice.html"

NOTE: Each additional mapping will require a separate sling:Mapping node with any arbitrary name.

Applies to

CQ 5.2.x, 5.3, 5.4

Download