Apache配置不同域名指向不同的目录

1、将域名指向同一个ip;


2、编辑httpd.conf,开启httpd-vhosts.conf配置,取消Include前面的注释

# Virtual hosts
Include conf/extra/httpd-vhosts.conf


3、编辑extra/httpd-vhosts.conf


    DocumentRoot "D:/Development/Data/Projects/php/htdocs"
    ServerName iyume.com


    DocumentRoot "D:/Development/Data/Projects/php/htdocs"
    ServerName www.iyume.com




    DocumentRoot "D:/Development/Data/Projects/php/demo"
    ServerName demo.com
   
        AllowOverride All
        Options Indexes FollowSymLinks
        Require all granted
   



    DocumentRoot "D:/Development/Data/Projects/php/demo"
    ServerName www.demo.com
   
        AllowOverride All
        Options Indexes FollowSymLinks
        Require all granted
   



至此,iyume.com指向htdocs目录,demo.com指向demo目录。

*403


        AllowOverride All
        Options Indexes FollowSymLinks
        Require all granted

你可能感兴趣的:(笔记)