Skip to content

Instantly share code, notes, and snippets.

@cimadai
Forked from sugamasao/sinatra_slash_redirect.rb
Created April 26, 2010 09:35
Show Gist options
  • Save cimadai/379145 to your computer and use it in GitHub Desktop.
Save cimadai/379145 to your computer and use it in GitHub Desktop.
# sinatra でのリダイレクト設定
# http://.../hoge のような '/' なしを '/' ありへリダイレクト
# ただし、 http://example.com の場合は末尾 '/' が付く
get %r{^(.+[^/])$} do |c|
redirect c + "/", 303
end
@cimadai
Copy link
Author

cimadai commented Apr 26, 2010

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment