title: Routing for multiple hosts in Cakephp
body: <p>As cookbook says:</p>
  
  <blockquote>
    <p>Routes can use the _host option to only match specific hosts. You can use the *. wildcard to match any subdomain.</p>
  </blockquote>
  
  <p>But what if I would like set same route for multiple hosts at once?</p>
  
  <p>For example:</p>
  
  <pre><code>$routes-&gt;connect(
      '/images',        
      ['controller' =&gt; 'Images', 'action' =&gt; 'index']
  )-&gt;setHost('images.example.com');
  
  $routes-&gt;connect(
      '/images',        
      ['controller' =&gt; 'Images', 'action' =&gt; 'index']
  )-&gt;setHost('images.example2.com');
  
  $routes-&gt;connect(
      '/images',        
      ['controller' =&gt; 'Images', 'action' =&gt; 'index']
  )-&gt;setHost('images.example3.com');
  </code></pre>
  
  <p>Above is pointless if I have to set several dozen of those routes.</p>
  
  <p>Ideal would be something like this:</p>
  
  <pre><code>$routes-&gt;connect(
      '/images',        
      ['controller' =&gt; 'Images', 'action' =&gt; 'index']
  )-&gt;setHosts(['images.example.com','images.example2.com','images.example3.com']);
  </code></pre>