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
# Rails3 way to redirect non-www domain to www domain | |
# Single domain redirect | |
'example.com'.tap do |host| | |
constraints(:host => host) do | |
match '/(*path)', :to => redirect { |params, request| Addressable::URI.escape request.url.sub(host, "www.#{host}") } | |
end | |
end |