I use the following code for a single entry:

{if no_results}{redirect="404"}{/if}

It works as expected for segment_1 urls (i.e. www.someurl.com/about-us), but if the template is not the index page of a template group, the same code throws a 404 error (i.e. www.someurl.com/abount-us/leadership).

If I remove limit="1" & require_entry="yes", it works fine.

What is going on here?

1 Answer 1


From the documentation of require_entry parameter:

This parameter tells the channel tag that it should expect the URL to contain a valid entry ID or a valid URL title. If an ID is not found in the URL, the tag will not display any data. Normally, the channel tag will show something, even if the URL doesn’t point to a particular entry. For example, your main channel page will typically show several of your most recent entries. Whereas your “single entry” pages, like your comment page, will show a single entry based on information in the URL. However, if one of your single entry pages is requested, but it doesn’t contain a valid ID, this parameter will tell the tag that you do not wish the template to display anything.

So, you shouldn't and don't need to use the both parameters entry_id and require_entry together. The strange behavior you're experiencing on your code looks like a conflict.

If you use the parameters entry_id or url_title, the no_results will work fine even without the parameter require_entry.

In my opinion, you should prefer to use the pages module.

  • Thanks for the reply. Still seems odd that it works on some templates but not others. I do not like the pages module. It's pretty clunky for clients to use. From what I have read, it seems most developers do not use the pages module.
    – mediapimp
    Commented Jul 16, 2013 at 19:01
  • This doesn't seems odd because, by default, segment_1 is never used to search for an entry. The entries are searched by the system using segments 2 or 3.
    – Sobral
    Commented Jul 16, 2013 at 22:27
  • Ah, yes. Didn't think about that. Thanks!
    – mediapimp
    Commented Jul 17, 2013 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.