2

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

1 Answer 1

4

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 %}.

1
  • 1
    If you're happy with your solution don't forget to accept your answer.
    – neekster
    Commented Dec 4, 2019 at 2:01

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.