在phpstudy2016版集成软件中,打开localhost访问文件报404错误。
解决方法
1.打开httpd-vhosts.conf文件,配置一个虚拟主机
<VirtualHost *:80>
DocumentRoot "D:\phpStudy\WWW"
ServerName localhost
ServerAlias
<Directory "D:\phpStudy\WWW">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
2. 将httpd.conf文件中的 ServerName localhost 注释掉(个别人中的语句可能会有些许差别)。
3.打开hosts文件,添加域名
127.0.0.1 localhost
4.重启Apache后,访问文件即可通过。
文章来源:https://www.cnblogs.com/superfat/p/5228347.html