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.

How do I make a closed pages module page goto 404?

November 12, 2012 7:04pm

Subscribe [2]
  • #1 / Nov 12, 2012 7:04pm

    eedfwChris

    54 posts

    I think the issue is that EE doesn’t know which template to render a “Closed” page with but I could be wrong.

    Here’s what I would think would work:

    {exp:channel:entries channel="page" require_entry="yes"}
     {if no_results}{redirect="404"}{/if}
     ...
    {/exp:channel:entries}

    I also tried:

    {exp:channel:entries channel="page"}
     ...
    {/exp:cannel:entries}
    {exp:channel:entries channel="page" status="not open"}
     {if no_results}{redirect="404"}{/if}
    {/exp:channel:entries}

    Ideas?

  • #2 / Nov 14, 2012 12:07am

    Try adding status=“open” to the first one.

  • #3 / Nov 14, 2012 6:44pm

    Also, ensure that you’ve enabled strict urls.

  • #4 / Nov 15, 2012 10:16am

    Dan Decker

    7338 posts

    Hi Chris,

    Thanks for posting your question to the Forums!

    When you say “page” are you referring to the Pages Module, or simply an entry?

    Once an entry is set to “closed”, by default ExpressionEngine should not try to display it. But with the Pages Module, I’m not sure how ExpressionEngine should behave.

    Can we come in for a look?

    Cheers,

  • #5 / Nov 15, 2012 7:38pm

    At least on 1.x, a Pages entry set to something other than the specified status is redirected to a 404 as expected.

    Edit: Works on 2.x as well.

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

ExpressionEngine News!

#eecms, #events, #releases