Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Translation of shortened URL's by Sling Mappings

Avatar

Level 2

What is the best way to translate shortened URL's ?

I was going through the documents & the only way I could find was via sling:alias.

While testing sling:alias on few of the content pages we can see that the full URL's render perfectly but it doesn't work on shortened URL's.

(Note - The shortened URL's are driven by Sling Mappings and adding values of sling:alias in sling-mappings is not a feasible solution)

Is there any other best way to design this solution or is it not feasible?

6 Replies

Avatar

Level 10

MOst of the docs I read about this - such as this show full URLs - -How to translate the page URL – Clay Tablet Technologies

I am checking with the team as well.

Avatar

Level 2

It works for URL shortened by Dispatcher Rules

Like - domain.fr/support-french.html > domain/content/test/fr/fr/support.html

But doesn't work for URL's that have sling mappings rules on them

Like- domain.fr/categoryname-french/productname-french.html > 404

Sling Mapping exist as -

content/test/fr/fr/categoryname/productname internally redirects to  content/test/fr/fr/categoryname/subcategoryname/rangename/productname

Wondering if there is any way AEM is be able to identify alias while mapping URL's

Avatar

Community Advisor

Do you mean vanities by shortened urls?

If yes, then you could take advantage of vanity configuration in the page properties, that gets saved on jcr:content as 'sling:VanityPath' property. Add this additional property to the translation workflow and even manage the redirects using this vanity (you would need to enable vanity in dispatcher configuration).

*sling vanity is different than sling mapping

Avatar

Level 2

Sling Mappings already exist & the ask is just to translate the URL's that are shortened by the sling mappings as explained in the comment above.

Avatar

Level 7

Hi,

in my experience typically i'm using the resource resolver factory for the outgoing URL and rewrite URL on apache for the incoming rule.

chlimage_1

As you can see from this image, typically we are using the apache to rewrite the short url, in this way when the request come into AEM has the same path that we have in the repository.

The outcoming url are configured by using a regex in the Apache Sling Resource Resolver Factory:

Screen Shot 2019-01-24 at 19.10.37.png

If you need more details, you can check the following documentation which describe all the way to manage the URL:

Using Dispatcher with Multiple Domains

Avatar

Level 10

Here is the best practice and it does discuss URLS. However - not shortened URLS: SEO and URL Management Best Practices

This would be the guideline to follow.

Also - still waiting to hear back from the team.