問題: Apache上的個人主頁系統
目的:
1.WEB:http://www.site.com/~username
2.FTP :/www/free/username/public_html
方法一:使用mod_userdir模塊
需要使用Apache 之中的userdir_module,
將
LoadModule userdir_module libexec/apache2/mod_userdir.so
之前的#去掉,
然後如下配置:
UserDir /www/free/*/public_html/
<Directory /www/free/*/public_html>
DirectoryIndex index.html
</Directory>
方法二:使用rewrite
需要使用Apache之中的rewrite_module,
將
LoadModule rewrite_module libexec/apache2/mod_rewrite.so之前的#去掉,
然後如下配置:
RewriteRule ^/~([0-9A-Za-z_/-]+)(.*) /wwww/free/$1/public_html$2
<Directory /www/free/*/public_html>
DirectoryIndex index.html
</Directory>
說明:
1.用戶的FTP可以使用任何FTP系統來指定其路徑爲/www/free/username
lyxz