我在 URL 上有一个小网站localhost/site/。它有一个.htaccess文件,一个index.php文件和一个用于存储图像的文件夹,称为img
.htaccess 文件
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+) index.php?url=$1 [QSA,L]
正如上面的代码,如果 url 不是目录或文件,每个 urllocalhost/site都会重定向到。index.php
index.php 文件
<html>
<body>
<img src="img/logo.png"/>
</body>
</html>
问题
当我转到localhost/siteorlocalhost/site/[any_text]时,它工作正常,这index.php将成功加载文件img/logo.png。
但是,如果我进入或进一步进入(实际上不退出,只有一个请求)中的localhost/site/[any_text]/[any_text]任何子目录,则不会加载localhost/siteindex.phpimg/logo.png
那为什么?