一、修改httpd.conf
 
文件目录 xampp => apache =>conf => httpd.conf

1.在文件内搜索 关键字“httpd-vhosts.conf”,找到如下字段

# Virtual hosts
Include conf/extra/httpd-vhosts.conf//确保此段开头没有#

2.在文件内搜索关键字“AllowOverride All”,找到如下字段

<Directory "D:/xampp/cgi-bin">
AllowOverride All
Options None
Require all granted
</Directory> //修改为
<Directory "D:/xampp/cgi-bin">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

3.搜索字段“DocumentRoot”,如下

DocumentRoot "D:/xampp/htdocs"//确保此处路径是你要访问的项目的根路径

ps:可以配置特定的根路径,比如: DocumentRoot "D:/www"

二、修改httpd-vhosts.conf

文件目录 xampp => apache =>conf => extra => httpd-vhosts.conf

文件最后面可看到如下

##<VirtualHost *:80>
##ServerAdmin webmaster@dummy-host2.example.com
##DocumentRoot "D:/xampp/htdocs/dummy-host2.example.com"
##ServerName dummy-host2.example.com
##ErrorLog "logs/dummy-host2.example.com-error.log"
##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>

1.用ip访问

<VirtualHost 127.0.0.5:80>//设置访问的ip
##ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "D:/www"//你的项目文件目录
ServerName testname.dev//此项目的名称
##ErrorLog "logs/dummy-host2.example.com-error.log"
##CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

2.用ServerName访问

<VirtualHost *:80>
##ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "D:/www"//你的项目文件目录
ServerName testname.dev//此项目的名称,通过此名称来访问项目,还需配置hosts文件
##ErrorLog "logs/dummy-host2.example.com-error.log"
##CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

3.配置hosts文件

文件目录 C:\Windows\System32\drivers\etc\hosts
在文件中加入
127.0.0.1 testname.dev

三、修改完记得重启aphache在进行访问三、修改完记得重启aphache在进行访问

 

最新文章

  1. C/C++ 标准输入输出重定向
  2. iOS中如何监测来电
  3. GridView控件RowDataBound事件中获取列字段值的几种途径 !!!
  4. osg四元数设置roll pitch heading角度
  5. PNG图片数据解析
  6. MySQL日期和时间函数
  7. case中定义变量
  8. C++实现Http Post请求
  9. 解决Uploadify上传控件加载导致的GET 404 Not Found问题
  10. 新注册第一帖----------------------乱码新手自学.net 之Linq 入门篇
  11. spring boot 自己输出json数据
  12. C#爬虫系列(二)——食品安全国家标准数据检索平台
  13. 使用Mermaid画图
  14. [Swift]LeetCode332. 重新安排行程 | Reconstruct Itinerary
  15. redis使用总结(二)(jedis使用)
  16. ViewPager实现滑动翻页效果
  17. linux环境快速安装python3
  18. blfs(systemd版本)学习笔记-编译安装sudo并创建普通用户配置sudo权限
  19. [leetcode 50]remove element
  20. HDU-4848 Wow! Such Conquering! (回溯+剪枝)

热门文章

  1. go遍历目录
  2. fabric应用
  3. php 利用迭代器遍历文件夹
  4. TOMCAT下面发布项目的4种方式
  5. dubbo-admin 管理平台
  6. 亲, 我们来再重申一遍&quot;==&quot;和&quot;equals的区别
  7. hdoj Max Sum Plus Plus(DP)
  8. 一些常用的c++系统函数
  9. Python globals() 函数
  10. PAT L3-008 喊山(广搜)