title: How to map a subdomain to an existing controller action in localhost
body: <p>I want to have a sub domain for this particular route</p>
  
  <pre><code>   get 'product_list/home'
  </code></pre>
  
  <p>Previously the url used to be like <code>localhost:3000/product_list/home</code>. Now I want the url to be <code>store.dev:3000/product_list/home</code>  </p>
  
  <p>I have modified the route like this</p>
  
  <pre><code> constraints subdomain: 'store' do 
        get 'product_list/home'
      end
  </code></pre>
  
  <p>In the /etc/hosts. I have added a store.dev as follows</p>
  
  <pre><code>127.0.0.1   localhost
  127.0.0.1   store.dev
  </code></pre>
  
  <p>But when visited <code>store.dev:3000</code> in dev environment, I am getting my homepage just like <code>localhost:3000</code>. </p>
  
  <p>But I want to restrict my subdomain to only this route <code>product_list/home</code>. </p>
  
  <p>And one more problem I am facing is </p>
  
  <p><a href="http://store.dev:3000/product_list/home" rel="nofollow">http://store.dev:3000/product_list/home</a> when I visit this</p>
  
  <p>I am getting this </p>
  
  <pre><code>No route matches [GET] "/product_list/home"
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>After changing the entry in the hosts file .. from <code>store.dev</code> to <code>store.local.dev</code> it works I am able to access <code>store.local.dev:3000/product_list/home.</code> But my problem is I am able to access other pages also, say I have <code>about</code> page. <code>store.local.dev:3000/about</code>, but I don't want this to happen. How to restrict the subdomain to only one particular route</p>