# Check wether an external alias is found and force a redirect if so RewriteMap visible dbm:/usr/local/etc/httpd/conf/visible RewriteCond ${visible:$1} . RewriteRule ^/~([^/]+)/*(.*)$ ${visible:$1}$2 [R,L] # First we have to append a slash to user directories where the trailing slash # is missing. If we just say /* in the folling rule, sublinks won't work. RewriteRule ^(/~[^/]+)$ $1/ [R,L] # Now map internal aliases to user directories, if found - if not, just leave # the request as is. We have to add PT to allow for mod_userdir RewriteMap invisible dbm:/usr/local/etc/httpd/conf/invisible RewriteCond ${invisible:$1} . RewriteRule ^/~([^/]+)/(.*)$ ${invisible:$1}$2 [PT]