portagenetwork / roadmap

Developed by the the Alliance in collaboration with University of Alberta, DMP Assistant a data management planning tool, forking the DMP Roadmap codebase
MIT License
6 stars 1 forks source link

Handle redirects from old hostname to new hostname #458

Closed aaronskiba closed 1 year ago

aaronskiba commented 1 year ago

Given the update of the domain name from 'assistant.portagenetwork.ca' to 'dmp-pgd.ca' we will need the app to facilitate this transition.

Should all requests to 'assistant.portagenetwork.ca/path/to/page' be immediately redirected to 'dmp-pgd.ca/path/to/page'? If so, then maybe the following example will work for us?:

https://stackoverflow.com/questions/7578853/redirect-from-old-domain-to-new-one-seo-friendly/7578867#7578867

class ApplicationController
  before_action :redirect_if_old

  protected

  def redirect_if_old
    if request.host == 'assistant.portagenetwork.ca'
      redirect_to "https://dmp-pgd.ca#{request.fullpath}", :status => :moved_permanently 
    end
  end
end
lagoan commented 1 year ago

We will keep the changes to hostnames handled in the proxy.