Rails: routing problems?

software development



after uploading newer version of my app, carefully avoiding config, but overwritting public, and fixing things I messed this way, everything started working except all my images and stylesheets are not displaying. When I enter it directly, for example DreamHost banner http://www.onerandomsite.com/images/468x60-e.gif
I get 404 error. Image is there, all small letters etc, but for some reason it doesn’t pick it up. This used to work before.

Anyway, anything I was able to find that might bring any light to this is following from my production.log

ActionController::RoutingError (Recognition failed for “/images/468x60-e.gif”):
/vendor/rails/actionpack/lib/action_controller/routing.rb:469:in recognition_failed' /vendor/rails/actionpack/lib/action_controller/routing.rb:459:inrecognize!’
/vendor/rails/railties/lib/dispatcher.rb:38:in dispatch' /vendor/rails/railties/lib/fcgi_handler.rb:141:inprocess_request’
/vendor/rails/railties/lib/fcgi_handler.rb:53:in process!' /vendor/rails/railties/lib/fcgi_handler.rb:52:ineach_cgi’
/usr/lib/ruby/1.8/fcgi.rb:597:in each' /usr/lib/ruby/1.8/fcgi.rb:597:ineach_cgi’
/vendor/rails/railties/lib/fcgi_handler.rb:52:in process!' /vendor/rails/railties/lib/fcgi_handler.rb:22:inprocess!'

If anyone would have some idea what might be wrong and where to look, I would greatly appreciate.
I also checked permissions and they seem ok.

Help ! :slight_smile:



If mod_rewrite is set up correct, as a I understand things, the request will only hit rails (and thus require “routing” via the route map) if the file doesn’t actually exist. So the fact that you’re getting a request for a static image that hits your route map inside your app means that somewhere along the line, apache is unable to find your file.

What does your .htaccess look like?

Also, in the panel config for the domain, is the root of your domain pointing to


rather than yourdomain.com/railsappname/public

? If so, then /images is really
/home/username/yourdomain.com/images rather than



thank you for your post. It really helped put things in perspective. Yes, I had domain point to /public and I looked at .htaccess multiple times and also someone said it might cause problems when you edit and have .htaccess~ file. Anyhow, nothing seemed to help, however after reading your post, I realised that whatever it causes problems it must be in .htaccess, since looking at it doesn’t help, I copied from site that works OK one and it fixed it and all the images appeared right.

Thank you, you put things in perspective and helped me resolve this issue.

Zeljko Dakic