Sha256: b7ce5a34b94e974059984e6c6d7a08dee58394d045437c423d7317d23ab3340b
Contents?: true
Size: 514 Bytes
Versions: 15
Compression:
Stored size: 514 Bytes
Contents
module Locomotive module Middlewares class SeoTrailingSlash def initialize(app, opts = {}) @app = app end def call(env) path = env['PATH_INFO'] if !path.starts_with?("#{Locomotive.mounted_on}/") && (match = path.match(%r{(.+)/$})) response = Rack::Response.new response.redirect(match[1], 301) # moved permanently response.finish response.to_a else @app.call(env) end end end end end
Version data entries
15 entries across 15 versions & 2 rubygems