title: Route using either a prefix or a domain
body: <p>I am working on a platform that allows users to run their own site in either a sub folder of the main website domain, or map a custom domain for their site.</p>
  
  <p>When using a custom domain the URL structure for each route is slightly different in that it is prefixed with the username, but when using a custom domain then this prefix is not used.</p>
  
  <p>Is there a clever way to achieve this in my Route::group to handle both request types in one route and successfully use reverse routing to produce the appropriate URL based on the parameters passed to it.</p>
  
  <p>Below is an example of using the prefix </p>
  
  <pre><code>Route::group(array( 'prefix' =&gt; 'sites/{username}'), function() {
      Route::get('/photos/{album_id}.html', array('uses' =&gt; 'Media\PhotosController@album_view', 'as' =&gt; 'photo_album'));
  });
  </code></pre>
  
  <p>And here is an example of using a custom domain</p>
  
  <pre><code>Route::group(array('domain' =&gt; '{users_domain}'), function() {
      Route::get('/photos/{album_id}.html', array('uses' =&gt; 'Media\PhotosController@album_view', 'as' =&gt; 'photo_album'));
  });
  </code></pre>
  
  <p>Ideally I would like to be in a position where I could use either</p>
  
  <pre><code>route('photo_album', ['username' =&gt; 'johnboy', 'album_id' =&gt; 123] )
  </code></pre>
  
  <p>and be returned</p>
  
  <pre><code>http://www.mainwebsitedomain.com/sites/johnboy/photos/123.html
  </code></pre>
  
  <p>or call the same route with different parameters </p>
  
  <pre><code>route('photo_album', ['users_domain' =&gt; 'www.johnboy.com', 'album_id' =&gt; 123] )
  </code></pre>
  
  <p>and be returned</p>
  
  <pre><code>http://www.johnboy.com/photos/123.html
  </code></pre>