gpt4 book ai didi

php - 对现有文件的请求执行 index.php

转载 作者:搜寻专家 更新时间:2023-10-31 22:14:55 24 4
gpt4 key购买 nike

我使用以下 .htaccess 代码在网站中启用友好 URL。

<IfModule mod_rewrite.c>

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]

</IfModule>

代码工作正常,但有一个小异常(exception)。当我在浏览器中请求一个文件(即图像)时,浏览器会加载它(如我所料),但同时会执行 index.php。

我想知道为什么。

最佳答案

事实证明,浏览器正在发出 GET/favicon.ico 请求,因为根据 .htaccess 中的规则,服务器上没有具有该名称的文件> 文件,请求被重定向到 /index.php

关于php - 对现有文件的请求执行 index.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7683705/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com