apache基于多域名的虚拟主机
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/var/www/html/xk/shuyou"
ServerName www.shuyou.group
ServerAlias shuyou.group
ErrorLog logs/shuyou_error.log
CustomLog logs/shuyou_access.log common
</VirtualHost>
<VirtualHost *:80>
ServerName www.lizhi.group
DocumentRoot "/var/www/html/xk/lizhi"
ErrorLog logs/lizhi_error.log
CustomLog logs/lizhi_access.log common
</VirtualHost>
禁用一个或多个ip访问
<Directory "/var/www/html">
Order deny,allow
Allow from 0.0.0.0
deny from 192.168.1.153
</Directory>
定义跳转
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^lizhi.group$ [OR]
RewriteRule ^(.*)$ http://www.shuyou.group/$1 [R=301,L]
时间: 2024-10-03 22:25:43