vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
DocumentRoot "/tmp/wangzi"
ServerName www.yangyang.com
##########取消默认虚拟主机###########
DocumentRoot "/data/www"
ServerName www.yangqiding.com
ServerAlias www.yanghao.com www.yangteng.com
# ErrorLog "logs/dummy-host.example.com-error_log"
# CustomLog "logs/dummy-host.example.com-access_log" common
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.yanghao.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.yangteng.com$
RewriteRule ^/(.*)$ http://www.yangqiding.com/$1 [R=301,L]
##########域名301跳转####################
AllowOverride AuthConfig
AuthName "www123com"
AuthType Basic
AuthUserFile /data/.htpasswd
require valid-user
DocumentRoot "/tmp/wangzi"
ServerName www.yangyang.com
##########取消默认虚拟主机###########
DocumentRoot "/data/www"
ServerName www.yangqiding.com
ServerAlias www.yanghao.com www.yangteng.com
# ErrorLog "logs/dummy-host.example.com-error_log"
# CustomLog "logs/dummy-host.example.com-access_log" common
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.yanghao.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.yangteng.com$
RewriteRule ^/(.*)$ http://www.yangqiding.com/$1 [R=301,L]
##########域名301跳转####################
AllowOverride AuthConfig
AuthName "www123com"
AuthType Basic
AuthUserFile /data/.htpasswd
require valid-user
编辑回复