Forum OpenACS Q&A: Response to users and "~user" apache emulation

Posted by David Walker on
You can mess with the procedure some. This procedure works if /home/user/public_html is a symlink to /var/public_html/user

if your permissions allow it you could change /var/public_html/${user_name}/ to /home/${user_name}/public_html/

I haven't tested this so it might not work right off.
proc tilde_to_user_filter {} {
    set urlv [ns_conn urlv]

    set tilde_user_name [lindex $urlv 0]
    set user_name [string range $tilde_user_name 1 end]
    set filename /var/public_html/${user_name}/[join [lrange $urlv 1 
end] /]
    # remove any characters or strings you find undesirable
    set filename [string map { " " "_"  ";" "" "|" "" } $filename]
    ns_returnfile 200 [ns_guesstype $filename] $filename

ns_registerproc GET /~* tilde_to_user_filter