一、错误截图
二、分析
- 找不到文件路径,应该是哪里地址配错了,或者路由规则(编写失败 / 被删除)
三、可能的原因
1、httpd-vhosts.conf文件配置地址错误
找到
XAMPP的安装目录
>apache
>conf
>extra
>用编辑器打开httpd-vhosts.conf
,是不是配置的项目地址Directory
写错了
- 1)、
Directory
写错了,冲突了 - 2)、
ServerAdmin
写错了,冲突了,与hosts(C:\Windows\System32\drivers\etc\hosts)
文件中配置的127.0.0.1 local.tp.com
对应。
<VirtualHost *:8010>
ServerAdmin local.tp.com
ServerName local.tp.com
ServerAlias local.tp.com
DocumentRoot "H:\test\thinkphp\public"
<Directory "H:\test\thinkphp\public">
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.htm index.php
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Directory>
</VirtualHost>
2、public目录下的 .htaccess 文件缺失
文件内容如下:
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{
REQUEST_FILENAME} !-d
RewriteCond %{
REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>