Sha256: 16acac9f0c88142f24e99c0318be477d627ac95af9921f3d008b78b6a9f93cc0

Contents?: true

Size: 523 Bytes

Versions: 3

Compression:

Stored size: 523 Bytes

Contents

module Locomotive
  module Concerns
    module RedirectToMainHostController

      extend ActiveSupport::Concern

      included do

        before_filter :redirect_to_main_host

      end

      private

      def redirect_to_main_host
        return if Locomotive.config.host.blank?

        if request.host != Locomotive.config.host
          options = { host: Locomotive.config.host }
          options[:port] = request.port if request.port != 80

          redirect_to options
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
locomotivecms-3.0.0 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
locomotivecms-3.0.0.rc7 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
locomotivecms-3.0.0.rc6 app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb