1

The following is within the index template on a site in production:

{% set domain = craft.request.getServerName() %}
{% if domain starts with 'subdomain' %}
    {% include 'subdomain/index' %}
{% else %}
    {% include 'homepage' %}
{% endif %}

It works without any problem on that server. I've just copied the site over to a another server for development, but that same code seems to be responsible for a 500 error. The following works, so I think it's to do with Twig's start with conditional:

{% set domain = craft.request.getServerName() %}
{% if domain == 'subdomain.domain.com' %}
    {% include 'subdomain/index' %}
{% else %}
    {% include 'homepage' %}
{% endif %}

I'm assuming it's a PHP setting - does anyone know which?

  • What's the actual error? It's either going to be logged in your craft/storage/runtime/logs files or on your web server's error logs depending on if your web server or Craft generated the 500. – Brad Bell Nov 10 '15 at 17:55
  • Actually, this seems to have gone away now. I've tracked it down to image transforms failing because of the usual max upload size and so on. Sorry to waste your time on this. – Clive Portman Nov 11 '15 at 11:19
1

I was able to reproduce this without the starts with, and editing the usual PHP settings which cause problems with uploading assets sorted this out.

| improve this answer | |

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.