Rack middleware to force redirects all traffic to a single domain with or without www.
#default installation gem install rack-www #when using bundler gem 'rack-www'
Default usage:
#redirects all traffic to www config.middleware.use Rack::WWW
You can also customize the :www option to true or false:
#redirects all traffic to www config.middleware.use Rack::WWW, :www => true #redirects all traffic to the same domain without www config.middleware.use Rack::WWW, :www => false
If you like it’s also possible to show a message while redirecting the user:
config.middleware.use Rack::WWW, :www => false, :message => "You are being redirected..."
MIT License. Copyright 2011 Jhimy Fernandes Villar. www.stjhimy.com