开发者

Requests to existing files execute index.php

I use the following .htaccess code to enable friendly URLs in a website.

<IfModule mod_rewrite.c>

    RewriteEngine on
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(开发者_JAVA百科.*)$ index.php?$1 [L]

</IfModule>

The code works fine with a small exception. When I request a file in the browser (i.e. an image), the browser loads it (as I would expect), but along with that index.php gets executed.

I wonder why.


It turned out the browser was making GET /favicon.ico requests and since there was no file with that name on the server, based on the rules in the .htaccess file, the requests were redirecting to /index.php.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜