Hello,

I want to make my application installable in URL subdirectories (ie
http://example.com/myapp/)

So I followed the Cookbook
(http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Rewriting) and
added this in the before_dispatch hook :
push @{$c->req->url->base->path->trailing_slash(1)},
    shift @{$c->req->url->path->leading_slash(0)};

That works well, except for one thing : url_for('/') returns "/myapp"
instead of "/myapp/"

This is a real problem for me as I use url_for('/') in javascript
templates. For example :
function (foo) {
   return '<%= url_for('/') %>'+foo;
}

So, this function, which returns '/foo' if I don't have the hook,
returns '/myappfoo' instead of '/myapp/foo'.

Is this a bug, or did I something wrong ?

Second question : is there a way to determine if we are in a
subdirectory ? If not, I will just let the user say it in the
configuration file.

Thank you
-- 
Luc
http://www.fiat-tux.fr/
Internet n'est pas compliqué, Internet est ce que vous en faites.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to