I purchased a domain to redirect back to me rails app that has a lot of urls like "/story.php/ and I want to redirect all of them to my ‘welcome#index’
My current code is:
get 'story.php*', to: redirect('/', status: 301)
and it’s at the top of the routes file to insure it matches first (if appropriate). I feel like I’m missing something obvious.
The fix for future reference:
get '/story.php', to: redirect('/')
and I want to give a BIG thanks to @walterdavis for being so helpful and sharing some world-class docs
Are you sure you want to wake up Rails for each of these types of things, particularly if you aren’t doing anything special with them? You might want to investigate URL rewriting in your Web server. Apache has mod_rewrite, NGINX has [something, I am sure].
It could save you a lot of cycles if you don’t have to descend all the way through the Web server, the Application server, and thence into Rails just to redirect to /.
Do you have any resources you’d suggest to learn how to do this? I’ve done some googling, but I the devops world is a little new to me (I’m currently hosting on heroku and believe I’m using a puma server if that makes any difference)
Do you get an error, or does it just ignore you? Have you tried these with the server running in development mode locally, and watched the console as the request is processed?