I need to implement url shortening functionality in two ways. First, I don’t want to show site structure (/content/site/en/..) in browser url. Secondly, <a href> url on component should show only short url instead of complete page hierarchy (not starting with /content). I have seen multiple forums, but got confused between which one to use when? Can somebody please explain the use of these?
Solved! Go to Solution.
Views
Replies
Total Likes
Sling Mapping:
* works and you can implement even complex scenarios (e.g. different rules for different hostnames)
* is complicated to configure and design a ruleset
Sling Resource Resolver Factory
* can implement only simple cases (e.g. remove /content/mysite from all urls),
Apache mod_rewrite
* easy to use, good understanding and help available
* Only rewrites incoming requests, does not rewrite links inside HTML
Vhost redirect
* probably less features than mod_rewrite but with the same limitations
Hi Karan,
Resource Resolver Factory is the solution for your case; just configure url mapping like [1] it will hide the configured content hierarchy in both the cases, url and anchor tags. Check the url mapping description in configuration for more details
[1] /content/site/en/-/
Thanks, @vijkumar. I am more interested in knowing in which scenarios, I should use other options as mentioned in the original ticket. I mean what is the pros and cons of using each option.
Views
Replies
Total Likes
Sling Mapping:
* works and you can implement even complex scenarios (e.g. different rules for different hostnames)
* is complicated to configure and design a ruleset
Sling Resource Resolver Factory
* can implement only simple cases (e.g. remove /content/mysite from all urls),
Apache mod_rewrite
* easy to use, good understanding and help available
* Only rewrites incoming requests, does not rewrite links inside HTML
Vhost redirect
* probably less features than mod_rewrite but with the same limitations
thanks Joerg.
Does sling mapping and Sling Resource Resolver Factory both support url shortening both ways (inbound and outbound). I mean in the browser and in <a> tag?
What is the format to provide two-way mapping in Sling Resource Resolver Factory? I tried with colon ":", but it didn't work with /content/site/en/rps.html$:/
Views
Replies
Total Likes
According to the documentation "/content/site:/" should be the right rules.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies