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?

2
  • 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
    Commented Nov 10, 2015 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. Commented Nov 11, 2015 at 11:19

1 Answer 1

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.

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.