Skip to content

Instantly share code, notes, and snippets.

@jfernandez
Created June 5, 2010 17:22
Show Gist options
  • Save jfernandez/426802 to your computer and use it in GitHub Desktop.
Save jfernandez/426802 to your computer and use it in GitHub Desktop.
require 'rack-rewrite'
DOMAIN = 'www.production-hacks.com'
# Redirect to the www version of the domain in production
use Rack::Rewrite do
r301 %r{.*}, "http://#{DOMAIN}$&", :if => Proc.new {|rack_env|
rack_env['SERVER_NAME'] != DOMAIN && ENV['RACK_ENV'] == "production"
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment