Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are a couple of approaches:</p> <ol> <li>Rewrite the urls on the outbound response in CQ (as suggested by David)</li> <li>Rewrite the urls on the inbound request using mod_rewrite at dispatcher (assuming Apache)</li> </ol> <p>As David covered scenario 1, I'll describe the second scenario</p> <p>The "sticky" selector value can be returned in a cookie to the client</p> <pre><code>Set-Cookie: selector=stickyselector; </code></pre> <p>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:</p> <pre><code>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 </code></pre> <p>So a request that arrives at the dispatcher looking like this:</p> <pre><code>GET /content/mysite/mypage.html HTTP/1.1 Cookie: selector=stickyselector; </code></pre> <p>Would arrive at the publish instance rewritten as:</p> <pre><code>/content/mysite/mypage.stickyselector.html </code></pre> <p>If you are using this approach for device/channel specific renditions then you <em>could</em> alternatively use the user agent value instead of a cookie to drive selector addition. For example:</p> <pre><code>RewriteCond %{HTTP_USER_AGENT} "iphone|ipod|iemobile" [NC] RewriteRule ^(.*)\.html$ /$1.mobile.html [PT] # add channel selector to the request url </code></pre> <p>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.</p> <p>Negatives are that it normally would require cookies and it depends on apache configuration.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload