Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
It may be hard to find in the docs, but you can use mruby in H2O to rewrite URLs: https://h2o.examp1e.net/configure/mruby.html Unlike Apache, you can use an actual programming language to do the ...
Answer
#1: Initial revision
It may be hard to find in the docs, but you can use mruby in H2O to rewrite URLs: https://h2o.examp1e.net/configure/mruby.html Unlike Apache, you can use an actual programming language to do the rewriting. This should work for your situation: ``` reproxy: ON paths: "/": mruby.handler: | lambda do |env| if /\/([^?]+)(\?.*)?/.match(env["PATH_INFO"]) return [307, {"x-reproxy-url" => "/#{$1}.php#{$2}"}, []] end return [399, {}, []] end ``` H2O's documentation says that "H2O recognizes status code 399 which can be used to delegate request to the next handler." I tested the regex in irb, but I haven't tested it with H2O.