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.
e.g
https://example1.com/en.html
https://example2.com/en.html

Both the sites are mapped to different nodes as below

https://example1.com/en.html  --> /content/example1/en
https://example2.com/en.html --> /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:// example1.com/en.html
RewriteRule ^/en.html https:// example1.com/en.html
RewriteRule ^/en/(.*)$ https:// example1.com/en/$1

Repeat the same for example2.com 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 example1.com 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/example1.com/ 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 example2.com and for all the publisher.

Now the websites can be accessed as follow
example1.com/en.html 
example2.com/en.html

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



1 comment:

  1. I have problems in Mapping in publisher in configuring same short urlvanity url with https in aem.with your knowledge sharing we overcome this.thank you.
    Regards,
    Lweblogic 12c training and Oracle SOA training.

    ReplyDelete