<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV>Hey guys.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I've been playing with RedirectHandler and it's pretty neat, but I question its usefulness.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>At work we do the trendy "/javascripts/spy.1152734636.js"-style asset includes rather than the default Rails style of "/javascripts/spy.js?1152734636". This is no problem with mod_rewrite as we run the basic Apache => Pen => Mongrel setup.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Now, sometimes we want to run Mongrel in production mode on our dev boxes. In these cases we'd be hitting Mongrel straight-on. As you can imagine, all of the /js/file.number.js includes are 404's. </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Here's the deal: if I register a RedirectHandler on '/javascripts' and try to redirect to '/javascripts/x', everything explodes. Is there a way around this? I am registering my RedirectHandler using the 'uri' method in a file passed to mongrel_rails via -S.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Before RedirectHandler was included in Mongrel we had worked out a solution: a gem_plugin we joking called mongrel_rewrite.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>You simply create 'config/rewrites.rb' in your Rails root. Ours looks like this:</DIV><DIV> RewriteRules = {</DIV><DIV> /\/(.+)\/(\w+)\.\d+\.(js|css|gif|jpg|png)/ => '/$1/$2.$3'</DIV><DIV> }</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>If the plugin (gem) is installed, it will rewrite params[Mongrel::Const::PATH_INFO] based on this RewriteRules hash (if it can find the config file) by benevolently sitting atop Mongrel::HttpRequest. Works like a charm.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Is there a use for this? Am I just setting up my RedirectHandlers wrong? I'd like to do things the Official way, so any help on the RedirectHandler would be appreciated.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thanks.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>In case anyone wants check this plugin out, it's really similar to the RedirectHandler:</DIV><DIV> - <A href="http://code.ozmm.org/rewrite/">http://code.ozmm.org/rewrite/</A></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">---</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- [ chris wanstrath, <A href="mailto:chris@ozmm.org">chris@ozmm.org</A> ]</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- [ <A href="http://ozmm.org">http://ozmm.org</A> ]</DIV></SPAN><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>