Most people don't want to get a 404 page, however, I am having issues with a site where 404 pages don't show when you enter an erroneous URL.

Example: http://livefreehomehealthcare.com/products/asdasdasdasd/ does not exist, but instead of a 404 page, which has been created and works (see example), I get the products page or segment_1 of the URL.

It appears that if segment_1 is a valid part of the URL then the strict URL rule that should redirect to the 404 page doesn't fire properly.

I am running EE 2.5.2

Update: MediaGirl suggested below that I use the require_entry="yes" parameter in the channel tags. I did this and it works too well.

Here's what I mean. I am using the index template of the template group for the "home" page for the section so that "our products" shows up as /products/ instead of /products/our-products. Here is the code:

{exp:channel:entries channel="products" entry_id="12"}

This displays the content fine, but is also open to 404 failure. So I tried this:

{exp:channel:entries channel="products" entry_id="12" require_entry="yes"}
{if no_results}{redirect="404"}{/if}    

When I do it this way 404 works too well and I can't see the contents of the /product/ page.

Is there a happy medium here?

Any ideas for getting this to work correctly would be appreciated.


  • You'll likely get a better answer if you post some simplified template code so we know how you are using your 'products/index' template. Also, for starters, check that you have strict urls enabled. This is a helpful article on ensuring 404s in a variety of situations: Guide to 404 Pages with ExpressionEngine.
    – Alex Kendrick
    Commented Dec 14, 2012 at 19:36

3 Answers 3


Since you are hard-coding an entry_id in your channel:entries tag in your products/index template, and as long you don't need any additional url segments to trigger other behavior (such as pagination or for dynamically loading another entry), you could just do this:

{exp:channel:entries channel="products" entry_id="12"}
    {if segment_2 != ""}
  • Hi Alex, this is a good idea but what happens of someone thumbs it and types: /products/abd ?
    – forrest
    Commented Dec 14, 2012 at 21:45
  • If I understood your question correctly, that's exactly the scenario in which you wanted to trigger a 404. Since /products/abd wouldn't be a valid URL. Correct? Or did I misinterpret your question?
    – Alex Kendrick
    Commented Dec 14, 2012 at 21:53
  • Hi Alex, gotcha. I see what you are saying here. I misread the != as ==. Thanks.
    – forrest
    Commented Dec 15, 2012 at 15:42
  • A great link to bookmark regarding the entire 404 topic in EE is: joviawebstudio.com/index_ee.php/blog/… . I refer to it regularly. Commented Dec 16, 2012 at 15:53

There are 3 things that should fix this.

  1. Assign your 404 error template in your "Global Template Preferences" which can be found at Design > Templates > Template Preferences

  2. In your products template, add the require_entry="yes" parameter to your channel:entries tag

  3. Inside that channel:entries tag add the following to redirect incorrect requests to the 404:

    {if no_results}{redirect="404"}{/if}
  • 1
    Also relevant to this question is Erik's copious answer here. Commented Dec 14, 2012 at 20:32
  • Thanks for the response. In theory this sounds good, however, I am still getting an error on the main products page. Please see my modified question above.
    – forrest
    Commented Dec 14, 2012 at 21:16
  • Please post the complete template code to pastie.org and paste the link back here as a comment. I'm not able to help further without seeing all you code.
    – Anna_MediaGirl
    Commented Dec 14, 2012 at 22:40

If you're using dynamic:


Make sure you add


Otherwise EE will load ALL entries... in other words:

if(entry found) {
    show entry;
else if (dynamic && !require_entry) {

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.