Sha256: 18dded69dae40712959760439402c9ad1782c7417de0f2456610db78f095bc11
Contents?: true
Size: 667 Bytes
Versions: 1
Compression:
Stored size: 667 Bytes
Contents
class RedirectController < ContentController session :off def redirect if (params[:from].first == 'articles') path = request.path.sub('/articles', '') url_root = request.relative_url_root path = url_root + path unless url_root.nil? redirect_to path, :status => 301 return end r = Redirect.find_by_from_path(params[:from].join("/")) if(r) path = r.to_path url_root = request.relative_url_root path = url_root + path unless url_root.nil? or path[0,url_root.length] == url_root redirect_to path, :status => 301 else render :text => "Page not found", :status => 404 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
typo-5.1.3 | app/controllers/redirect_controller.rb |