How to map multiple domains to one CQ5 instance

Question

A CQ5 instance hosts multiple websites in different content branches. How is it possible to map a domain to a specific content branch to support multi-domain hosting scenarios?

Answer, Resolution

CQ5 which is based on Apache Sling [1] provides the necessary functionality through repository-based configuration. When resolving resources, these so-called mappings are applied.

The following example configuration is based on the Geometrixx website that comes per default with a CQ5 installation. The Geometrixx website is already multilingual and serves perfectly as example.

The goal is to configure these mappings:

Domain                      Content branch
www.geometrixx.fr /content/geometrixx/fr
www.geometrixx.de /content/geometrixx/de

These nodes have to be created in the default workspace of the repository via the CRX Content Explorer, required nodetypes in brackets:

/etc
   /map                       (sling:Folder)
      /http                   (sling:OrderedFolder)
         /www_geometrixx_fr   (sling:Mapping)
         /www.geometrixx.fr   (sling:Mapping)
         /www_geometrixx_de   (sling:Mapping)
         /www.geometrixx.de   (sling:Mapping)

2 mappings are required:
  • map the root context to the index-page of the language branch, e.g. www.geometrixx.fr --> /content/geometrixx/fr.html
  • map resources to the corresponding language branch

Following is the JSON representation of the configuration necessary to map these 2 domains (/etc/map/http.tidy.-1.json):

{
  "jcr:primaryType": "sling:OrderedFolder",
  "www_geometrixx_fr": {
    "sling:internalRedirect": [
      "/content/geometrixx/fr.html"
    ],
    "jcr:primaryType": "sling:Mapping",
    "sling:match": "www.geometrixx.fr/$"
  },
  "www.geometrixx.fr": {
    "sling:internalRedirect": [
      "/content/geometrixx/fr",
      "/"
    ],
    "jcr:primaryType": "sling:Mapping"
  },
  "www_geometrixx_de": {
    "sling:internalRedirect": [
      "/content/geometrixx/de.html"
    ],
    "jcr:primaryType": "sling:Mapping",
    "sling:match": "www.geometrixx.de/$"
  },
  "www.geometrixx.de": {
    "sling:internalRedirect": [
      "/content/geometrixx/de",
      "/"
    ],
    "jcr:primaryType": "sling:Mapping"
  }
}

Attached there is also a Content Package [2] with above example configuration.

Applies

CQ5.2.x, CQ5.3

[1] Apache Sling"s Flexible Resource Resolution
[2] geometrixx_domain_mapping.zip

ดาวน์โหลด

 Adobe

รับความช่วยเหลือได้เร็วและง่ายกว่าเดิม

หากคุณเป็นผู้ใช้ใหม่

Adobe MAX 2024

Adobe MAX
การประชุมความคิดสร้างสรรค์

14-16 ต.ค. Miami Beach และออนไลน์

Adobe MAX

การประชุมความคิดสร้างสรรค์

14-16 ต.ค. Miami Beach และออนไลน์

Adobe MAX 2024

Adobe MAX
การประชุมความคิดสร้างสรรค์

14-16 ต.ค. Miami Beach และออนไลน์

Adobe MAX

การประชุมความคิดสร้างสรรค์

14-16 ต.ค. Miami Beach และออนไลน์