title: rails 3 redirect missing url to root
body: <p>I am trying to set up some semistatic page in a rails 3 app,
  I have created a Pages controller with some non restful actions</p>
  
  <pre><code>class PagesController &lt; ApplicationController
  
    def home
    end
    def about
    end
    def contact
    end
    def monday
    end
    def saturday
    end
    def sunday
    end
  
  end
  </code></pre>
  
  <p>it's showing the pages well at pages/monday etc... or /monday etc... if i set up the routes as is <a href="https://stackoverflow.com/questions/8946181/rails-3-removing-controller-name-form-url">rails 3 removing controller name form url</a></p>
  
  <p>But I was just wondering if it is possible to redirect a missing url to /. As per exampel i have /monday set up, but if one plays with the url and input /tuesday it won't hit a page. can i redirect this kind of actions?</p>
  
  <p>==EDIT==</p>
  
  <p>I've change my code to this:</p>
  
  <pre><code>  resources :pages, :path =&gt; '/' do
      collection do
        # # match 'tuesday' =&gt; redirect('/')
        # # match 'wednesday' =&gt; redirect('/')
        # # match 'friday' =&gt; redirect('/')
        %w{home monday thursday saturday sunday about contact resources}.each do |url|
          get url
        end
      end
   end
   match 'pages/*page' =&gt; :root
  </code></pre>
  
  <p>the url rewriting works fine looping through the array.
  I tried the put the wild cardline at the bottom of my root files and at the bottom of the resources :page block. But I get a "controller action show could not be found" message.</p>
  
  <pre><code>match 'pages/*page' =&gt; :root
  </code></pre>
  
  <p>IS that the correct place to put it to restrain missing url like /tuesday to generate an error page?
  is it also possible to limit this redirection only to a few actions and not to all missing pages? ex only to tuesday, wednesday, friday...</p>