Sha256: a180d57ba0dfabc67a05e427da5de8f7785546b107d16c3d670cb034972b2f08
Contents?: true
Size: 581 Bytes
Versions: 39
Compression:
Stored size: 581 Bytes
Contents
# frozen_string_literal: true module Alchemy module SiteRedirects extend ActiveSupport::Concern included do before_action :enforce_primary_host_for_site, if: :needs_redirect_to_primary_host? end private def enforce_primary_host_for_site redirect_to url_for(host: current_alchemy_site.host), status: :moved_permanently end def needs_redirect_to_primary_host? current_alchemy_site.redirect_to_primary_host? && current_alchemy_site.host != '*' && current_alchemy_site.host != request.host end end end
Version data entries
39 entries across 39 versions & 1 rubygems