Created
January 11, 2016 18:29
-
-
Save kbaum/b62cadbfb47ca0c6d38b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def query_params_to_query(request) | |
query_params = request.params.except(:path, :format) | |
query_params.any? ? "?#{query_params.to_query}" : "" | |
end | |
#redirect apex http://viewthespace.com http://vts.com domain to www.vts.com | |
constraints(host: %r{^vts.com}) do | |
redirect_action = ->(params, _request) do | |
"https://www.vts.com/#{params[:path]}#{query_params_to_query(_request)}" | |
end | |
root to: redirect(redirect_action) | |
match '/*path', to: redirect(redirect_action) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment