Add 301 redirect for Link item
This commit is contained in:
parent
aab1199aee
commit
ce63c53605
|
@ -14,10 +14,12 @@ class RerouteMiddleware
|
|||
|
||||
entry = Item.find_by_name( parsed_entry_name )
|
||||
|
||||
case entry.type
|
||||
when Component :
|
||||
case entry.type.to_s
|
||||
when 'Component' :
|
||||
env['REQUEST_URI'] = env['REQUEST_URI'].sub!(parsed_entry_name, entry.engine_name)
|
||||
env['QUERY_STRING'] = (env['QUERY_STRING'].blank?)? "entry_name=#{parsed_entry_name}" : "entry_name=#{parsed_entry_name}&#{env['QUERY_STRING']}"
|
||||
when 'Link' :
|
||||
return [301, {'Location' => entry.url }, ['See Ya!']]
|
||||
end
|
||||
|
||||
@app.call(env)
|
||||
|
|
Reference in New Issue