Life will be easier if you can do a slight modification to your url, something like:
https://www.domain_name.com/enc/hdurstihnzdfalgfgdfhdrbnhduolsasrtyumyrtyr
Then you can create a route for that path to redirect where you want.
get '/enc/:encoded_path' => "controller#action"
This would give you access to params[:encoded_path]
, which would equal hdurstihnzdfalgfgdfhdrbnhduolsasrtyumyrtyr
in this case. From there, you could decode in the controller and then redirect however you want.