jtrupiano / rack-rewrite

A web server agnostic rack middleware for defining and applying rewrite rules. In many cases you can get away with Rack::Rewrite instead of writing Apache mod_rewrite rules.

Home Page:http://github.com/jtrupiano/rack-rewrite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Will not 301 to unicode URI

kalabiyau opened this issue · comments

r301 '/ashog.php', '/artists/гоша-ашог'

wil produce:

URI::InvalidURIError: bad URI

Only this will do

r301 '/ashog.php', (URI.parse(URI.encode '/artists/гоша-ашог')).to_s

doubt this problem anymore since 1.9 added decent unicode support

require 'rack/rewrite/rule'

Rack::Rewrite::Rule.new(:r301,'/ashog.php', '/artists/гоша-ашог')

# => <Rack::Rewrite::Rule:0x007f9c39122938 @rule_type=:r301, @from="/ashog.php", @to="/artists/гоша-ашог", @options={}>