URL rewriting (shortened URL)
I want the pages of my site to be shortened like this:
Original URL: www.mysite.com/content/my-site/en/home.html
Shortened URL: www.mysite.com/home
Reading "SEO and URL Management Best Practices" document it states that:
"The SlingResourceResolver can be found at /system/console/config on any AEM instance and it is recommended that you build out the mappings that are needed to shorten URLs as regular expressions and include these configurations under a config.publish OsgiConfig node that is included in your build. Rather than doing your mappings in /etc/map"
It also states that implementing mapping using /etc/map can lead to some issues:
"While this is the approach that is documented in the official AEM and Sling documentation, the regular expression support provided by this implementation is limited in scope when compared to the options that are available to us by using the SlingResourceResolver directly. Additionally, implementing mappings in this way can lead to issues with dispatcher cache invalidation"
Another advantage of using SlingResourceResolver is that you can use resourceResolver.map() to apply the mapping to the outputed URLs.
Now I couldn't figure out how to use SlingResourceResolver to do the mapping. I created an OSGI config node (config.publish) but it hasn't worked. I was just able to accomplish the mapping by using /etc/map. I'm a little bit lost of how using SlingResourceResolver to do the mapping.
Any help is appreciated!
Thanks!