Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi,

I've been using below code to make a section redirect directly to the first page in page-view, thus skipping the list-view:

Code: Select all
<cms:if k_is_list >
   <cms:pages order='asc' limit='1'>
      <cms:redirect url=k_page_link />
   </cms:pages>
</cms:if>


This works great except for when I turn on PrettyUrls. When PrettyUrls is switched on the page gives a "Too many redirects" error. It seems that even though the page is a 'page' (?p=x) its still being seen as 'k_is_list' so it enters a loop.

Maybe I'm using the wrong approach?
Hi,

I tested and your code works just fine (for me) even with prettyURLs.

Just to troubleshoot the issue, please try modifying the code to make it as follows -
Code: Select all
<cms:if k_is_list>
    <cms:pages order='asc' limit='1'>
        <cms:abort><cms:show k_page_link /></cms:abort>
    </cms:pages>
</cms:if> 

This would print out on screen the URL being redirected to. Try visiting that URL and see if the page can be accessed.

If this works, I think the cache could be the culprit. Please try disabling the cache (if enabled) or manually emptying the couch/cache folder.

Please let me know if this helps.
Hi KK, thanks for the quick reply.

Unfortunately your suggestion does not seem to work. When I use your code it gives me the full url of the page (site/section/page.html). When I try to access that url it again fails and just keeps showing the same full url, suggesting it's being seen as 'k_is_list'.

Cache is and was turned off.
That is pretty strange.
Could you get me FTP + Couch access to your site please?
Let me take a look at the problem myself.
4 posts Page 1 of 1