I'm using the extra segment approach to direct requests to pages, as described here:

Template Routes and extra segments

This is working great and allows me to create a common wrapper for pages, but how do I deal with 404's?

It doesn't seem to matter what I set 'Template to be used as the 404 error page' to it still directs to the index/index template, which contains the following:


and so always gets 'resolved'.

is there a way that I can test that this calls a valid page: {embed='pages/{segment:extra}'}

Or is there another approach I could use?

1 Answer 1


Seems like your index page not have any restriction to check weather the entry exists or not. You can do this with various ways. Best way is to put a condition under channel entry of that page that will redirect to 404 if no entry is match with it.


    {!--No parameters if your entries URL title is last segment--}
    {!--If you have entry_id--}
    dynamic="no" entry_id="{ENTRY_ID}"

    {!--If you have URL title--}
    dynamic="no" url_title="{segment_2}"

    {!--If page is dynamic (Pages module redirct page or some way dynamic page) --}

    {!-- Syntax to call 404 is {redirect="404"} --}
    {if no_results}{redirect="404"}{/if}

    {!--My channel content etc.--}

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.