Skip to content

Instantly share code, notes, and snippets.

@scottmessinger
Created August 23, 2012 18:24
Show Gist options
  • Save scottmessinger/3439910 to your computer and use it in GitHub Desktop.
Save scottmessinger/3439910 to your computer and use it in GitHub Desktop.
Change to hlavka for routing
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :ensure_domain
APP_DOMAIN = 'www.commoncurriculum.com'
STAGING_DOMAIN = 'hlavka-staging.herokuapp.com'
def ensure_domain
if request.env['HTTP_HOST'] != APP_DOMAIN && request.env['HTTP_HOST'] != STAGING_DOMAIN && Rails.env != 'development'
# HTTP 301 is a "permanent" redirect
redirect_to "http://#{APP_DOMAIN}", :status => 301
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment