Reputation: 8444
This question is a follow-up question to my previous one that can be found here. If I have a website www.foo.com
and the user types in www.foo.com/blahblahblah
I want it to redirect to the root path and be able to manipulate the text blahblahblah
. I used the solution proposed on that question by Rob Davis and it works correctly for the most part -- if the user types in something like www.foo.com/a/b/c
it redirects to the root path and the string a/b/c
is correctly being stored in params[:not_found]
. However, if the user enters something with a question mark, like www.foo.com/a?b=c
then all that gets stored in params[:not_found]
is a
and ?b=c
vanishes. How do I ensure that question mark or not, all the text after www.foo.com/
gets stored in params[:not_found]
?
Again, please first read the question and the solution here. Then if you can answer this question that would be awesome!
Upvotes: 1
Views: 1061
Reputation: 25280
Rails routes can only match patches, not querystrings.
If you use the first example Rob Davis gave you (the one without the redirect), you'll be able to inspect the querystring parameters using:
request.query_string
Check this, might be useful as well: Rails Routing with Query String
Upvotes: 1