Is there a way in EE1 (nice to know for EE2 as well) to check and see if a page_uri exists and if not redirect them to a 4040 page? Since page_uri's can be just about anything and any depth it's impossible to use common conditionals to see if a segment is empty or uses a specific keyword. This question came up in regard to an EE1 site but if it's possible to do this in EE2 as well it would be helpful to know.


Would it not be the case that if you turned strict URLs on then if the page didn't exist you would get the 404 page?

  • Strict URLs are turned on and I do have a 404 page selected. – Stuart McCoy Jun 18 '13 at 13:00

There's this EE1 plugin Any Segment that should do what you want. Right from the docs

{if {exp:any_segment equals="projects"}} ... Show content {/if}

In EE2 i would use {last_segment} since typically your page_uri would be the last segment.

  • There's no download available but if there were I'm not sure how flexible this would be given that I don't know what segments are being used and what their names are since the client is using the pages module and writing their own URLs. – Stuart McCoy Jun 18 '13 at 13:03

I'm not 100% what types of 404s you feel you are missing...

If you are worried about entry templates where no entry is specified you can use the "require_entry" parameter along with the if no_results conditional.

{exp:weblog:entries weblog="whatever" limit="1" require_entry="yes"}
{if no_results}

Does this get at what you are looking for? If not can you elaborate a little and give some examples?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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