-
-
Save jordanandree/3057752 to your computer and use it in GitHub Desktop.
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
require 'rack-rewrite' | |
DOMAIN = 'www.production-hacks.com' # also works with non-www url such as 'google.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