[Email protected] abc]# vim/usr/local/apache2/conf/extra/httpd-vhosts.conf
DocumentRoot "/data/www"
ServerName www.qq.com
Serveralias www.aqq.com
# errorlog "Logs/dummy-host.example.com-error_log"
# customlog "Logs/dummy-host.example.com-access_log" common
#users Ren Zheng
<Directory/data/www/abc>//user authentication
AllowOverride authconfig
AuthName "QQX"
# AUTHUSERFILE/DATA/.HTPASSWD
AuthType Basic
authuserfile/data/.htpasswd
Require Valid-user
</Directory>
<ifmodule mod_rewrite.c>//Domain jump 301
Rewriteengine on
Rewritecond%{http_host} ^www.qq.com$
Rewriterule ^/(. *) $ http://www.xx.com/$1 [r=301,l]
</IfModule>
</VirtualHost>
When you add multiple virtual hosts, the servername is different to access
This article is from the "ZPP" blog, make sure to keep this source http://1439337369.blog.51cto.com/10270624/1706678
Apache user authentication and domain jump