Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ApplicationController < ActionController::Base
- before_filter :check_uri
- def check_uri
- redirect_to request.protocol + "www." + request.host_with_port + request.request_uri if !/^www/.match(request.host)
- end
- end
- before_filter :check_uri
- def check_uri
- if /^www/.match(request.host)
- redirect_to request.protocol + request.host_with_port[4..-1] + request.request_uri
- end
- end
- head :moved_permanently, :location => ‘http://www.newdomain.com’
- def rails_301
- headers["Status"] = "301 Moved Permanently"
- redirect_to "http://www.newdomain.com"
- end
- def check_uri
- redirect_to request.protocol + "www." + request.host_with_port + request.request_uri if !/^www/.match(request.host) if Rails.env == 'production'
- end
Add Comment
Please, Sign In to add comment