Collect RoutingError messages thrown <p>I've just put a rails 4 app into production, and I've noticed what look like a number of scripted attacks, mostly on urls that end with .php. They look like this:</p> <pre><code>I, [2015-05-11T22:03:01.715687 #18632] INFO -- : Started GET "/MyAdmin/scripts/setup.php" for 211.172.232.163 at 2015-05-11 22:03:01 +0100 F, [2015-05-11T22:03:01.719339 #18632] FATAL -- : ActionController::RoutingError (No route matches [GET] "/MyAdmin/scripts/setup.php"): actionpack (4.1.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' </code></pre> <p>I'd like to collect thee url from these RoutingError messages, mostly so I can set up routes for them, probably to simply render nothing.</p> <p>I'd also like to redirect to a site which might keep script runners busy.</p> <p>Anyway, here's the question. Is there any way I can intercept ActionController::RoutingError to run some code?</p> <hr> <p>Bonus question: Does anyone know if there's actually a lot of php apps out there which can be broken into with urls like the one above?</p>