Craft looks for /templates/404 by default. What do you do if you have multiple sites?


I pondered this for a while, and then did this, which will direct us to specific entries (not templates, I don't want to create more of those):

{# We need a unique 404 for each site - just take us to the 
   right slug relative to current URL #}

{% switch currentSite.id %}

{# siteA.com #}
{% case 1 %}

    {% redirect '/my-404-slug' %}

{# siteB.com #}
{% case 2 %}

    {% redirect '/my-other-404-slug' %}

{% endswitch %}

If you want to use templates instead of entries, just use an {% include %} statement instead of {% redirect %}.

|improve this answer|||||
  • 1
    If you're happy with your solution don't forget to accept your answer. – neekster Dec 4 '19 at 2:01

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.