Answers.Body: <p>I was able to reproduce this without the <code>starts with</code>, and editing the usual PHP settings which cause problems with uploading assets sorted this out.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-11T11:20:58.377Z
Answers.LastActivityDate: 2015-11-11T11:20:58.377Z
Answers.UserDisplayName: Clive Portman
Body: <p>The following is within the index template on a site in production:</p>
  
  <pre><code>{% set domain = craft.request.getServerName() %}
  {% if domain starts with 'subdomain' %}
      {% include 'subdomain/index' %}
  {% else %}
      {% include 'homepage' %}
  {% endif %}
  </code></pre>
  
  <p>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 <code>start with</code> conditional:</p>
  
  <pre><code>{% set domain = craft.request.getServerName() %}
  {% if domain == 'subdomain.domain.com' %}
      {% include 'subdomain/index' %}
  {% else %}
      {% include 'homepage' %}
  {% endif %}
  </code></pre>
  
  <p>I'm assuming it's a PHP setting - does anyone know which?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-11-10T17:55:08.157Z
Comments.Text: 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.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-11-11T11:19:05.363Z
Comments.Text: 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.
Comments.UserDisplayName: Clive Portman
Tags: <templating><conditional><php><server><request>
Title: Twig's 'start with' conditional returns 500 error
ThreadText: # Twig's 'start with' conditional returns 500 error
  
  (Asked by: username_0 on 2015-11-10)
  
  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?
  
  **Tags:** templating, conditional, php, server, request
  
  > **Comments:**
  > **username_1**: 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.  
  > **username_0**: 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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-11-11. Score: 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.
  
  
  ---
  
  