Do you know if it's possible to redirect to a specific 404 page when a template group isn't found rather than just show the 404 with the incorrect url?

For example,

If I go to example.com/nonexistant-templategroup/ I need it to redirect to example.com/404/ rather than stay as /nonexistant-templategroup/ showing the 404 template.


1 Answer 1


You can accomplish that by doing the following:

  1. Make a template group called 404.group and in that template group create an index.html template (this will be your 404 template)
  2. Set "Enable Strict URLs" to "Yes" in your Global Template Preferences
  3. For the "404 Page" setting choose "404/index" (the template you created in step 1 above), again in your Global Template Preferences
  4. In 404.gorup/index.html put the following conditional

    {if segment_1 != "404" OR segment_2 != ""}

This will ensure that when a 404 is triggered and your 404 template is shown, it will be further redirected to the vanity 404 URL of just /404.

There are a couple potential downsides to doing this, though.

  • You won't have a record of these 404 URLs in Google Analytics so that you can see what URLs are erroring.
  • The http status will not actually be 404, but 302 (redirect). You could get around this by using the HTTP Header plugin and deliberately setting the status with {exp:http_header status="404"}
  • Thats perfect thanks! I was actually doing all of that apart from step 4, that was the missing piece of the puzzle.
    – KeironLowe
    Feb 18, 2014 at 9:48
  • You're welcome!
    – Alex Kendrick
    Feb 19, 2014 at 16:35

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.