Hello Team,
There are lots of information available for the short URL implementation. Wanted to know the right approach.
My scenario:
My project handles various domains. each content hierarchy supports various domain site.
abc.com
/content/client/abc/en
xyz.com
/content/client/xyz/en
pqr.com
/content/client/pqr/en
Short URL is handled via Apache Sling Resource Resolver Factory, Dispatcher configuration
In the Apache Sling Resource Resolver Factory configuration, we have added these values for publish env. run mode ( only for prod publish)
^/content/client/abc/(.+).html</$1.html
^/content/client/xyz/(.+).html</$1.html
^/content/client/pqr/(.+).html</$1.html
Then, in the Dispatcher, for each domain, we have separate redirect conf file.
So, in each file we have written these line for the re direction
RewriteRule ^/$ /en/home.html [R=301,NC,L]
This works perfect for all our sites. Even in any component, if we use internal page path then while on hovering the link, this shows short URL. This is good one.
However, I have noticed that short URL is enabled in prod publish environment. In this case, if I click on any menu(where we are showing the page hierarchy as menu, menu item), this goes to short URL. and then shows 404 response. Then, manually I need to use the long URL.
Anyhow, this is not a major blocker. Since, authors, testers use Prod author, then live site URL. Only developers are using prod publish for testing few pages.
Is this, the right approach? Can I utilize Sling Mappings – under etc/map
Checked these sites. But, still have confusion.
https://helpx.adobe.com/in/experience-manager/kb/multi-domain-management-aem-mappings-for-url-shorte...
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-url-shortening-functio...
Solved! Go to Solution.
Views
Replies
Total Likes
The best option is to use Sling Mappings.
Jorg Ho has already shared the comparison on https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-url-shortening-functio...
You can also refer to https://www.youtube.com/watch?v=bJ_cXcAE7G8&t=611s&ab_channel=TechForum. Here they have discussed with example about the challenges with "Apache Sling Resource Resolver Factory" approach
You will need to provide URL mapping for incoming request as well which will resolve to full url. But for your mapping it will be hard to resolve.
Instead you can try this
^/content/client/abc/(.+).html</abc/$1.html
^/content/client/xyz/(.+).html</xyz/$1.html
^/content/client/pqr/(.+).html</pqr/$1.html
^/content/client/abc/$1.html>/abc/(.+).html
^/content/client/xyz/$1.html>/xyx/(.+).html
^/content/client/pqr/$1.html>/pqr/(.+).html
I have not tested this.
The best option is to use Sling Mappings.
Jorg Ho has already shared the comparison on https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-url-shortening-functio...
You can also refer to https://www.youtube.com/watch?v=bJ_cXcAE7G8&t=611s&ab_channel=TechForum. Here they have discussed with example about the challenges with "Apache Sling Resource Resolver Factory" approach
Hi @Mahesh_Gunaje
I think whatever you have implemented is the right approach.
The use case you are talking about is rare but can be handled as well. but you need to think about what you would get v/s effort.
One of the solutions would be to send custom request headers to Publish to identify and based on that you do url shortening/remapping. e.g. if you are accessing the page via dispatcher add a custom request header. so that AEM can do url shortening.
Views
Replies
Total Likes
@Mahesh_Gunaje Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Views
Likes
Replies