How to configure link rewriting

Question

How do I configure link rewriting for internal links? E.g. I have internal links to /content/mysite/ch/de and want to rewrite these to /ch/de.

Answer, Resolution

CQ5.x is using Apache Sling's Resource Resolver mechanism to resolve and map links to so-called resources. Via the Felix Management Console, it is a matter of configuration to enable link rewriting for the example given above.

NOTE: if you're running CQ5.1, please install hotfix #20568 as a prerequisite, available from [1].

Here's what you do:

  • open the Felix Management Console, running on http://<host>:<port>/system/console
  • switch to the 'Configuration' tab
  • from the upper dropdown-box, select item 'Apache Sling Resource Resolver' and click 'Configure'
  • browse down to config-item 'URL Mappings' and add a mapping, e.g. /content/mysite/-/ 
  • save changes

Now CQ5 should rewrite all internal links according to the configured URL mappings. In addition to that, the Felix Management Console provides an overview of all currently configured resolver and map mappings. Simply switch to the 'JCR ResourceResolver' tab. It is also possible to test how the Resource Resolver will resolve or map URLs to resources.

For more information on how Sling's Resource Resolver mechanism works, please refer to [2].

 

CQ5.3

Starting with CQ5.3, the above configuration becomes deprecated. Instead of configuring the Sling Resource Resolver, it is recommended to use the URL Mapping capabilities of Sling to rewrite links. Please refer to the article How to map multiple domains to one CQ5 instance for an exemplary configuration.

 

Applies to

CQ5.1, CQ5.2

 

[1] Flexible Resource Resolution

Завантажити

 Adobe

Отримуйте допомогу швидше й простіше

Новий користувач?