Sunday, December 6, 2015

Configuring same short URL/Vanity URL for different sites with https – AEM/Adobe CQ5

This post will explain how to configure same short URL/Vanity URL for different sites that is accessible through https in Adobe CQ5/AEM.

Recently we had a scenario to be implemented, two different websites needs to be accessed with same URL and with https protocol.

Both the sites are mapped to different nodes as below  --> /content/example1/en --> /content/example2/en

Create the redirect rules in dispatchers, inside the corresponding virtual host (httpd.conf) to redirect the http request to https and to shorten the URL’s .

RewriteRule ^/content/example1/(.*)$  /$1 [NE,L,R=301]

RewriteCond %{HTTPS} off
RewriteRule ^/$ https://
RewriteRule ^/en.html https://
RewriteRule ^/en/(.*)$ https://$1

Repeat the same for and for all the dispatchers.

Mapping in publisher :

Go to <<AEM Publisher Host>>:4503/system/console/configMgr with admin credentials. Search for Apache Sling Resource Resolver, and change the value of mapping location from /etc/map to /etc/map.publish

Go to crx/de console,
Create a node with name map.publish of type sling:folder under /etc folder
Create a node with name https of type sling:OrderedFolder under /etc/map.publish
Create a node with name of type sling:mapping  under /etc/map.publish/https and give the properties as below,
Name : Sling:internalRedirect
Type : String[]
Value: /content/example1

Create a node redirect under /etc/map.publish/https/ as type
sling : mapping  and give the following properties.
Name : Sling: internalRedirect
Type: String []
Value: /content/example1/$1,/$1 2.

Name : Sling: match
Type: String
Value: (.+)$

Repeat the steps for and for all the publisher.

Now the websites can be accessed as follow

The Adobe CQ version referred here is Adobe CQ6.1.

No comments:

Post a Comment