Lighttpd: point to a different root of the document.

I have lighttpd-Setup pointing to the root of the document /var/www . However, I want the other/ URL to point to /some/other/dir . I do this with the following configuration:

 $HTTP["url"] =~ "^/other($|/)" { server.document-root = "/some/other/dir" } 

However, if I go to "http: // myhost / other", lighttpd tries to access /some/other/dir/other instead of just /some/other/dir . Is it possible to remove /other some way, but save any additional URL segments? So, for example, http://myhost/other/sub/foo.txt should point to /some/other/dir/sub/foo.txt .

+6
source share
1 answer

Instead of trying to set server.document-root , you can use mod_alias to achieve this:

 server.modules = ( ..., "mod_alias" ) ... alias.url = ( "/other/" => "/some/other/dir/" ) 

This will create an alias in such a way that all requests to /other/ and resources inside this folder will be redirected to /some/other/dir/ in the file system, and the request directly to /other/ will be sent directly to the root /some/other/dir/ like you.

+6
source

All Articles