This shows you how to do it using just the JCR Resource Resolver setting http://dev.day.com/content/kb/home/cq5/Development/How%20to%20configure%20link%20rewriting .html.
This is documentation on the more complex /etc/map approach https://cwiki.apache.org/SLING/flexible-resource-resolution.html. This will allow you to apply rules differently based on host name which you can't do with JCR Resource resolver.
You can combine either approach with using Apache mod_rewrite to do the incoming rewrites (which has the approach of ensuring that the content is cached with it's full URL in case you are want to use a single dispatcher to front for multiple web sites).
Using teh JCR resource resolver I can get it so the /content/site/en/ is stripped out, but I still have to go to en.html for the homepage. How can I get the homepage to act like a index.html file?
Also, once you change it so CQ is mapping the URL to pull out the /content/site/en, how do you configure the dispatcher?
Easiest way would be to put a '/' in the "Vanity URL" field of "basic" tab on "page properties" of your home page
You can configure a list of such varity URL's for each of your pages
www.geometrixx.com can be made to show en.html
www.geometrixx.com/en can also be made to show en.html and so on.
The problem with use a vanity URL for this and striping it out in the resource resolver is that the request won't get cached by dispatcher (and it's probably one of you most highly trafficed sites so you want it to get cached by dispatcher.
I have found that it's best to use your web server tier for this kind of mapping. If you are using Apache you can set up mod_rewrite to do a rewrite of / to /en.html and the change will be transparent to the end user, but dispatcher will think the request is for en.html and will cache the page appropriately. If you just pass / to dispatcher it won't cache the response.
If you have two sites, a mobile and desktop, how could you setup so that
the /content//en does not show up? If I change the
mapping on the resource resolver then the mobile site links will just
resolve to the desktop site.
How do you currently distingush between your desktop site and your mobile site? Is it based on host name?
If you have two different sites that are distingushed by host name you can't solve that problem with the JCR Resource resolver. You have two choices:
- Use Apache mod_rewrite to do the rewrites at the Apache layer. With mod_rewrite you can use the host name as part of your rule definition and map the host names to the correct paths.
- Use the /etc/map approach to configuring the resource resolver - you can see that documentation at https://cwiki.apache.org/SLING/flexible-resource-resolution.html- this will allow you to configure different resource resolution based on request data.
Using /etc/map, I can replace the incoming requests to insert a /content/<sitename>/en, but what about the URLs that are rendered in the html? Those URLs will still have the /content/<sitename>/en. Do I still have to use the JCR Resource Rsolver to truncate the URLs rendered in the HTML?
Links on page also get resolve using /etc/map entry (Unless link rewriter is disabled or those links in overriding pattern of Link checker confguration). You don't have to do any special configuration.
I set up /etc/map correctly (as far as I can read from /system/console/jcrresolver
Mapping Map Entries shows:
^/content/myapp/en/ http://localhost:8502/en-us/ external: 302
Link Checker Transformer is enabled, but still I get
So if there is no special configration needed, what am I doing wrong?
Hi - Did you solve this issue? and if so how please?
I have the same issue with URL mapping set for example: /content/xyzzy/en_us:/en_us and maps fine on way in but doesn't work on way out.
Also the only other issue is the package manger link on the main page doesn't link and I wondered if this was a link that was supposed to be rewritten on the way out but was not.
Thank you very much,
I am able to shorten URL in combination with apache and /etc/map/http CQ... and it works very well with http schema (non-secure). But same shortened URL not working with https (secure) ... Now you may ask https is configured on apache and CQ....so to reply on this... yes...it's configured and in fact complete URL works with https.
any speacial treatment for https to work???... in fact shortned URL does not work on CQ level itself. my sling mtach is like this "qa.abc.com/abc" and internalredirect is like this /content/abc/en.html.
entry is made in /etc/map/http/localhost_any.
Please share your thoughts.
You would have created redirections under /etc/map/http. You will also
have to create same redirections under /etc/map/https too.
Thamks, It works, unfortunately, its not mentioned anywhere in adobewiki/ doc.
I am glad about dispatcher caching as well ...cache folder got created under IHS cache directory in shortened URL manner and i thought this is different than actul crx strcuture and cache would not be flushed but i was proved wrong and flush works