Skip to content

Instantly share code, notes, and snippets.

@bentayloruk
Created August 18, 2011 13:34
Show Gist options
  • Save bentayloruk/1154063 to your computer and use it in GitHub Desktop.
Save bentayloruk/1154063 to your computer and use it in GitHub Desktop.
Rack re-write config
require "rack/jekyll"
require "rack-rewrite"
use Rack::Rewrite do
rewrite %r{^\/(.+)\/(\?.*)?$}, '/$1$2'
r301 %r{.*}, 'http://bentaylor.org$&', :if => Proc.new {|rack_env|
rack_env['SERVER_NAME'] != 'bentaylor.org'
}
r301 %r{(.*).aspx}, lambda { |match, rack_env|
match[1].downcase
}
r301 %r{^/(.*)/$}, '/$1'
end
run Rack::Jekyll.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment