Translation of shortened URL's by Sling Mappings

preeti_bhaya

24-01-2019

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?

Accepted Solutions (0)

Answers (6)

Answers (6)

smacdonald2008

24-01-2019

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.

antoniom5495929

24-01-2019

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

preeti_bhaya

24-01-2019

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.

Gaurav-Behl

MVP

24-01-2019

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

preeti_bhaya

24-01-2019

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