I can’t for the life of me work out why this doesn’t work so I thought I’d ask –
I’ve got a template which either shows a list of entries (max 10)
mydomain.com/blog
Paginates
mydomain.com/blog/P1 etc…
Or displays the entry
mydomain.com/blog/displays-the-entry-associated-with-this-url-title
The template is as follows –
{if segment_2 == '' OR segment_2 == 'P1' etc…}
{exp:channel:entries channel="blog" dynamic="no" limit="10" paginate="bottom" }
etc…
{/exp:channel:entries}
{if:else}
{exp:channel:entries channel="blog" dynamic="no" url_title="{segment_2}"}
etc…
{/exp:channel:entries}This works fine but obviously a person can type whatever they want into segment 2 which gives a poor experience when the page doesn’t exist. To prevent this I’d traditionally just add the following to the second channel entries tag:
{if no_results}
{redirect="/404"}
{/if}The problem is this is 404’ing the pagination URL’s. I can’t understand why the conditional statement is allowing this when it doesn’t allow the rest of the code between it.
I’ve been playing with it for several hours but I’m out of ideas, anyone know?