ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Question about 404 page and Pagination

September 23, 2010 7:05pm

Subscribe [3]
  • #1 / Sep 23, 2010 7:05pm

    mkornblum

    18 posts

    Hello,

    I have an index template listing a bunch of posts in the normal way through the weblog entries tag. i.e.:

    /template_group/

    To read an article in from this page, I point visitors to:

    /template_group/article/artile_title_here/

    I also have paging enabled, so if a user wants to see older articles off the index page, they go to a URL like this:

    /template_group/P10/

    etc.

    The problem I am having is that a user visiting a URL like this:

    /template_group/blajiophopaiheg/

    Is not shown a 404 page; rather, they are shown the index template. I have strict URLs enabled already and have read the articles telling me to use a combination of ‘require-entry=“yes”’ and the ‘if no results’ conditional. The problem is that from what I can tell I want to do something like this on my index template in /template_group/:

    {if segment_2 != '' && segment_2 != 'article'}
    {redirect="404"}
    {if:else}
    {exp:weblog:entries weblog="blog" limit="5" paginate="bottom"}
    display code here, etc
    {/if}

    The problem with this is that it breaks EE’s pagination, since the /P10/ part of the the URL is not ‘article’. Is there a way to both have pagination turned on, and show a 404 in this case? Is my only option to make something like /template_group/archive/ and force people who want to see older posts to look at that?

    Thanks in advance.

  • #2 / Sep 24, 2010 9:27am

    Ingmar

    29245 posts

    Yes, it would be easier to use EE’s default URL structure here, i.e. http://example.com/index.php/group/template/url_title.

    /template_group/ really refers to /template_group/index/.
    Otherwise you might have to use some PHP.

  • #3 / Sep 24, 2010 2:31pm

    mkornblum

    18 posts

    OK, I will make an archive template or something then.

    I dunno if this is already changed in 2.1, or if I should file a feature request, but it would be great if the built-in pagination feature could recognize its own pagination links as “valid” in the same way it recognizes a segment 2 URL title as “valid” when using the require_entry=“yes” parameter.

    Thanks for your help!

  • #4 / Sep 25, 2010 9:45am

    Sue Crocker

    26054 posts

    Sounds like you have a workaround you can use. Don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases