Sha256: 3e86efbf7d4a54c9bad067bfbf2cf6a2c2984196d2b84aa1187f47c4da04a4d2

Contents?: true

Size: 413 Bytes

Versions: 3

Compression:

Stored size: 413 Bytes

Contents

class RedirectController < ContentController
  session :off

  def redirect
    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

3 entries across 3 versions & 1 rubygems

Version Path
typo-5.0.1 app/controllers/redirect_controller.rb
typo-5.0.2 app/controllers/redirect_controller.rb
typo-5.0 app/controllers/redirect_controller.rb