title: How redirect to 404 page in routes.rb?
body: <p>How can I redirect incorrect url to 404 page in routes.rb?
  Now I use 2 examples code:</p>
  
  <pre><code># example 1
  match "/go/(*url)", to: redirect { |params, request| Addressable::URI.heuristic_parse(params[:url]).to_s }, as: :redirect, format: false
  
  # example 2
  match "/go/(*url)", to: redirect { |params, request| Addressable::URI.heuristic_parse(URI.encode(params[:url])).to_s }, as: :redirect, format: false
  </code></pre>
  
  <p>But when I try using russian words in 'url' parameter, in 1st example I get 500 page (bad URI), in 2nd - I get redirect to stage.example.xn--org-yedaaa1fbbb/ </p>
  
  <p>Thanks</p>