Sha256: f79444fab0e15c270495254417955dc703309c9dac40a79ea0005d5e6d578bd8
Contents?: true
Size: 611 Bytes
Versions: 5
Compression:
Stored size: 611 Bytes
Contents
class RedirectController < ContentController session :off def redirect # Ugly way to manage redirects, anything better ? if (request.request_uri =~ /^\/articles/) redirect_to request.request_uri.gsub('/articles', ''), :status => 301 return end r = Redirect.find_by_from_path(params[:from]) 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
5 entries across 5 versions & 1 rubygems