There are a couple of approaches:
- Rewrite the urls on the outbound response in CQ (as suggested by David)
- Rewrite the urls on the inbound request using mod_rewrite at dispatcher (assuming Apache)
As David covered scenario 1, I'll describe the second scenario
The "sticky" selector value can be returned in a cookie to the client
Set-Cookie: selector=stickyselector;
Each subsequent request to the site from the client will contain that cookie. You can then use that cookie to rewrite in the URL in apache before it gets presented to the dispatcher module (and eventually the publish instance:
RewriteCond %{HTTP:Cookie} selector=([^;]+) [NC] # If we have the selector cookie
RewriteRule ^(.*)\.html$ /$1.%1.html [PT] # add it to the request url before extension
So a request that arrives at the dispatcher looking like this:
GET /content/mysite/mypage.html HTTP/1.1
Cookie: selector=stickyselector;
Would arrive at the publish instance rewritten as:
/content/mysite/mypage.stickyselector.html
If you are using this approach for device/channel specific renditions then you could alternatively use the user agent value instead of a cookie to drive selector addition. For example:
RewriteCond %{HTTP_USER_AGENT} "iphone|ipod|iemobile" [NC]
RewriteRule ^(.*)\.html$ /$1.mobile.html [PT] # add channel selector to the request url
Positives of this approach are that all users are presented with the same URL (e.g./content/mysite/mypage.html) the selectors in URLs are only presented to CQ.
Negatives are that it normally would require cookies and it depends on apache configuration.