Created
August 28, 2012 16:24
-
-
Save stevenharman/3499918 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Brewhouse::Application.routes.draw do | |
constraints(host: /^(?!www\.)/i) do | |
match '(*any)' => redirect { |params, request| | |
URI.parse(request.url).tap { |uri| uri.host = "www.#{uri.host}" }.to_s | |
} | |
end | |
resource :drink_up, only: [:show] | |
root :to => redirect('/drink_up') | |
end |
This file contains hidden or 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
Brewhouse::Application.routes.draw do | |
constraints(host: /^www\./i) do | |
match '(*any)' => redirect { |params, request| | |
URI.parse(request.url).tap { |uri| uri.host.sub!(/^www\./i, '') }.to_s | |
} | |
end | |
resource :drink_up, only: [:show] | |
root :to => redirect('/drink_up') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
via: :all
should be appended tomatch
since Rails 4.