title: Redirecting to a subdomain using a variable(Ruby on Rails)
body: <p>I would like to redirect from a directory to a subdomain in Ruby on Rails.</p>
  <p>As it is, it goes to <code>slug.example.com</code>. How can I redirect it to <code>xxx.example.com</code>?</p>
  <pre class="lang-rb prettyprint-override"><code># slug = 'xxx'
  
  get '/users/:slug', to: redirect(subdomain: 'slug', path: '')
  </code></pre>