Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

my google-fu failed again, and i have a serious problem. I have a channel and template for it called html, when i go to page.com/html/(existing article name), it works just fine, but when i go to page.com/html/(non-existing article), it shows the article with lowest ID instead. So what am i asking for? How to redirect user to 404 page, when he opens page.com/html/(non-existing article name)?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

You need to use the require_entry parameter:

{exp:channel:entries limit="1" require_entry="yes" [...]}
  {if no_results}
    {redirect="404"}
  {/if}
  [...]
{/exp:channel:entries}

This parameter make the {if no_results} conditional available.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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