問題描述
如何根據用戶登錄重定向 Lighttpd webdav 掛載 (How can I redirect a Lighttpd webdav mount depending on user login)
I have enabled the lighttpd mod_webdav module and set up a webdav mount point of http://website.com/webdav using the following lighttpd.conf entry:
$["remoteip"] == "www.website.com" {
alias.url += (
"/webdav" => "/var/www/htdocs/webdav",
)
$HTTP["url"] =~ "^webdav($|/)" {
dir‑listing.activate = "enable"
webdav.activate = "enable"
webdav.is‑readonly = "disable"
auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = "/var/www/htdocs/passwd.dav"
auth.require = ("" => "method" => "basic",
"realm" => "webdav",
"require" => "valid‑user" ) )
}
}
This gives the same directory for all webdav users.
However, I would like to make http://website.com/webdav redirect to a particular subdirectory based on the webdav user name.
For example:
user logs in as user1, he/she sees htdocs/webdav/user1 when going to http://website.com/webdav or
user logs in as user2, he/she sees htdocs/webdav/user2 when going to http://website.com/webdav
Can this be done?
Thanks
‑‑‑‑‑
參考解法
方法 1:
Even though HTTP and WebDAV allows it, popular clients don't actually follow redirects. The result is that clients such as the windows client, os/x client can't connect to the url directly..