Created
December 2, 2018 18:56
-
-
Save simonfranzen/f94b89d4bc7f1b4210c77670e57e4ab8 to your computer and use it in GitHub Desktop.
Redirect all routes in RubyOnRails
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
Rails.application.routes.draw do | |
constraints(:host => /^(?!old-domain\.com)/i) do | |
match "/(*path)" => redirect { | |
|params, req| "https://new-domain.com/#{params[:path]}" | |
}, via: [:get, :post] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment