title: Prefix urls in Rails application
body: <p>I want all my pages in my 2.3 Rails application to have the url prefixed with:</p>
  
  <pre><code>www.example.com/app/
  </code></pre>
  
  <p>and I did this writing in <code>routes.rb</code> the following lines:</p>
  
  <pre><code># I named the first part of the url ':appl'
  map.root :appl =&gt; "app", :controller =&gt; "home"
  
  # Default routes
  map.connect ':appl/:controller/:action/:id'
  map.connect ':appl/:controller/:action/:id.:format'
  </code></pre>
  
  <p>It all works fine, with the exception of <code>map.resources</code>, where I have </p>
  
  <pre><code>map.resources :pages
  </code></pre>
  
  <p>and now wherever I have <code>edit_page_path</code> or <code>page</code>, the generated url's are not correct, because <code>app</code> is not inserted at the beginning. I've tried with <code>namespace</code> and <code>scope</code>, like I've seen <a href="http://guides.rubyonrails.org/routing.html" rel="noreferrer">here in chapter 2.6</a>, but with no success. </p>
  
  <p>How should I do this? Is the <code>:appl</code> in routes  a bad idea?</p>