XAMPP 找不到对象,Error 404

一、错误截图

在这里插入图片描述

二、分析

  • 找不到文件路径,应该是哪里地址配错了,或者路由规则(编写失败 / 被删除)

三、可能的原因

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>

猜你喜欢

转载自blog.csdn.net/qq_36025814/article/details/114692184
404