apache多个虚拟主机配置及重写
apache多个虚拟主机配置及重写
apache多个虚拟主机配置及重写
1
修改http.conf 在最后或者 host 那段下面添加 或者直接修改
httpd-vhosts.conf也可以,但是要在下面开启引用。
www.2cto.com
01
NameVirtualHost *:80
02
03
04
05
Options FollowSymLinks
06
AllowOverride None
07
Order allow,deny
08
Allow from all
09
10
11
Options FollowSymLinks Indexes
12
AllowOverride None
13
Order allow,deny
14
Allow from all
15
16
17
18
19
ServerName linux.centos.vbird
20
DocumentRoot /var/www/html
21
22
23
ServerName www.centos.vbird
24
DocumentRoot /var/www/www
25
CustomLog /var/log/httpd/www.access_log combined
26
27
28
29
ServerName ftp.centos.vbird
30
DocumentRoot /var/ftp
31
1
开启后只能通过 域名访问 如果通过ip访问会默认进入进入第一个地址,要调整顺序的话只需要调整他们的位置就好了。
01
02
重写配置
03
04
05
06
07
08
09
10
Options Indexes followsymlinks
11
12
13
14
AllowOverride all
15
16
17
18
Order allow,deny
19
20
21
22
Allow from all
23
24
25
26
27
1
.htaccess文件规则
01
02
03
04
RewriteEngine on
05
RewriteCond %{REQUEST_FILENAME} !-f
06
RewriteCond %{REQUEST_FILENAME} !-d
07
RewriteCond $1 !^(index\.php|images|robots\.txt)
08
RewriteRule ^(.*)$ index.php/$1 [L]
09
10
11
12
13
14
15
16
17
18
评论暂时关闭