The rails application I'm currently running is running on a domain for a former wordpress site which has hacked. Every once and a while I'll receive an routing error notification for a PUT that the website does not and should not support. Obviously, I can't prevent these requests from being made but I would like to handle them gracefully.
In my routes file I already have all unknown paths redirect to the root_url
as noted in this SO post on routing unknown requests with the code:
match '*path' => redirect('/'),via: [:get, :post] unless Rails.env.development?
Even with that, I still receive errors, like the following:
ActionController::RoutingError: No route matches [PUT] "/cmyks42567.txt"
How do I redirect this in the routes file without writing a controller to pass the specific url and redirect?