I have this configuration:

   alias.url = (
       "/acruz/" => "/var/www/localhost/htdocs/acruz/",
       "/jvangemeren/" => "/var/www/localhost/htdocs/jvangemeren",
       "/doceno/" => "/var/www/localhost/htdocs/doceno"

I already tried using alias.url += for each one, but it is only working with the first one: acruz, the other ones are not working... any ideas?

EDIT 1: lighttpd -p -f result

This is the result with the current configuration:

alias.url            = (
    "/acruz/"       => "/var/www/localhost/htdocs/acruz/public/",
    "/jvangemeren/" => "/var/www/localhost/htdocs/jvangemeren/public",
    "/doceno/"      => "/var/www/localhost/htdocs/doceno/public",
    # 3

And after doing it with += it is the same...

  • 1
    I don't know lighttpd, but the difference I see between the first entry and the 2./3. is that the first ends with /, but the others not. Worth a try to use "/jvangemeren/" => "/var/www/localhost/htdocs/jvangemeren/, ...?! – mpy Apr 30 '13 at 14:44
  • Thanks a lot! This was the problem. I was missing / at the end of the directory. Thanks a lot! Please, add this as an answer so I can mark it as such – AbrahamSustaita Apr 30 '13 at 14:54

I retrieved the doc of lighttpd's mod_alias module. I bet you have a problem with the trailing slashes. Be sure that all alias entries end with a slash:

alias.url = (
       "/acruz/" => "/var/www/localhost/htdocs/acruz/",
       "/jvangemeren/" => "/var/www/localhost/htdocs/jvangemeren/",
       "/doceno/" => "/var/www/localhost/htdocs/doceno/"

There is also an important note in the documentation:

As trailing slashes are stripped from the url before matching an alias, the alias "/content/ => "/dirtocontent/" will not match the url "/content/"; it matches only something like "/content/somefile" or "/content/somesubdir/".

So in most cases you shouldn't use a trailing slash on the left side (but use it on the right side!): "/content" => "/dirtocontent/"

Now "/content_x1/" is mapped to "/dirtocontent/_x1", "/content/" -> "/dirtocontent/" and "/content/somefile" -> "/dirtocontent//somefile" (yes, double slash).

If you don't use it on the right side too, "/content_x1/" is mapped to "/dirtocontent_x1", which you probably don't want.

  • No, the problem is not that. I'm working on /acruz/ and everything works perfect. If you read carefully, the problem was the other two aliases were not respected at all. But you gave me already the solution. The problem was the / I was missing at the end of the directory. – AbrahamSustaita Apr 30 '13 at 14:58
  • 1
    @AbrahamSustaita: Better? I wrote this answer prior getting notification of your comment... ;) – mpy Apr 30 '13 at 15:02

Use lighttpd -p -f /etc/lighttpd/lighttpd.conf to see how lighty sees your config after += evaluation.

  • @AbrahamSustaita if the output with -p is the same, lighty really should do the same. Make sure lighty actually got restarted and is running with the config you think it is. You could also show us the two configs that you tried, just describing changes is error prone. – Stefan Apr 30 '13 at 14:41
  • I did it... it shows the exact same result – AbrahamSustaita Apr 30 '13 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.