Apache配置不同域名指向不同的目錄
1、將域名指向同一個ip;
2、編輯httpd.conf,開啟httpd-vhosts.conf配置,取消Include前面的註釋
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
3、編輯extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "D:/Development/Data/Projects/php/htdocs"
ServerName iyume.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/Development/Data/Projects/php/htdocs"
ServerName www.iyume.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/Development/Data/Projects/php/demo"
ServerName demo.com
<Directory "D:/Development/Data/Projects/php/demo">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/Development/Data/Projects/php/demo"
ServerName www.demo.com
<Directory "D:/Development/Data/Projects/php/demo">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
至此,iyume.com指向htdocs目錄,demo.com指向demo目錄。
*403
<Directory "D:/Development/Data/Projects/php/demo">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>