php - xampp没有加载图像
问题描述
图像未加载到 xammp 包中。
我的 apache 虚拟主机配置:
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\shop.local"
ServerName shop.local
ErrorLog "logs/shop.local-error.log"
CustomLog "logs/shop.local-access.log" common
</VirtualHost>
我的目录结构:
- public
- .htaccess
- index.php
- errors
- 404.php
- images
- 404.png
- vendor
- .htaccess
根目录中的 htaccess:
AddDefaultCharset utf-8
RewriteEngine On
RewriteRule (.*) public/$1
公共目录中的 htaccess:
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule (.*) index.php?$1 [L,QSA]
index.php 文件:
<?php
require dirname(__DIR__) . '/public/errors/404.php';
404.php 文件:
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<div class="wrap">
<div class="logo">
<img src="/errors/images/404.png">
</div>
</div>
</body>
</html>
阿帕奇日志:
127.0.0.1 - - [15/Sep/2019:01:35:14 +0300] "GET /public/errors/404.png HTTP/1.1" 200 141
解决方案
我只是在 .htaccess 中写错了条件
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
适当地:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
推荐阅读
- python - Numpy 从谷歌云存储加载内存映射数组(mmap_mode)
- python - 当最后一批样本未达到 batch_size 时,Keras.Reshape 层出错
- c# - SignalR:GetHubContext 不调用客户端方法,但直接引用集线器会
- python - BeautifulSoup 获取响应内容失败
- java - RedisTemplate 未在 Spring Boot 中获取数据
- node.js - 使用 Cosmos DocumentDB 生成选择列表
- scala - list.filter(!=) 编译,但没有按预期工作
- java - 文件 libsc68.dylib 丢失?
- azure - Azure devops 中的服务连接创建操作失败
- php - 如何从 json url 获取特定数据