如何让域名指向目录

注意:案例是php集成环境

一、让目录允许访问

找到 vhosts.conf 修改配置如下:

<VirtualHost _default_:80>
DocumentRoot "E:\phpStudy\PHPTutorial\WWW"
  <Directory "E:\phpStudy\PHPTutorial\WWW">
    # Options -Indexes -FollowSymLinks +ExecCGI 把 -Indexes 参数去掉就行了
    Options -FollowSymLinks +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>

二、添加虚拟主机

http://www.abc.com是指向同一台服务器的新域名,在这里把其指向到abc目录下,在 vhost.conf 里追加如下配置:

<VirtualHost *:80>
    ServerName http://www.abc.com
    DocumentRoot C:/phpStudy/PHPTutorial/WWW/abc
    DirectoryIndex index.html index.php  
</VirtualHost>

作者:webStyle_虎_
链接:https://www.jianshu.com/p/f164d0ed6c92
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

    原文作者:Yel_Liang
    原文地址: https://blog.csdn.net/Yel_Liang/article/details/95238986
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞