简体   繁体   English

为什么我在mod_pagespeed中获得了PNG的404

[英]Why i'm getting a 404 for PNG in mod_pagespeed

I have a small problem with the mod_pagespeed module in Wordpress on Apache server. 我在Apache服务器上的Wordpress中的mod_pagespeed模块有一个小问题。 I'm getting a 404 related only to PNG images, but not always, not for all and not even for the same images. 我得到的404仅与PNG图像相关,但并非总是如此,并非总体而言,甚至不是相同的图像。 Automatically, sometimes you see, sometimes not instead. 自动,有时你会看到,有时候不会。

When it happens, i try to disable the mod_pagespeed inserting ?ModPagespeed=off , and magically PNG images appear correctly. 当它发生时,我尝试禁用mod_pagespeed插入?ModPagespeed=off ,神奇的PNG图像正确显示。

Always when it happens, hanging on the URL ?ModPagespeed=on&ModPagespeedFilters= you see the PNG images. 总是当它发生时,挂在URL上?ModPagespeed=on&ModPagespeedFilters=你看到了PNG图像。

Again you see the PNG also enabling a filter at a time with for example: 您再次看到PNG也一次启用过滤器,例如:

?ModPagespeed=on&ModPagespeedFilters=extend_cache . ?ModPagespeed=on&ModPagespeedFilters=extend_cache

At this point, i think that it might be a problem of RewriteCond in .htaccess file. 在这一点上,我认为它可能是.htaccess文件中的RewriteCond问题。 So, i put the exception: 所以,我把例外:

RewriteCond %{REQUEST_URI} !pagespeed

under: 下:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

But still doesn't work. 但仍然行不通。 Do i also hang it with the basic rules of Wordpress? 我是否还将其与Wordpress的基本规则挂起? That are the follow: 这是以下内容:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

What do you think? 你怎么看?

Thanks in advance 提前致谢

Your RewriteCond: 你的RewriteCond:

RewriteCond %{REQUEST_URI} !pagespeed

has two problems with it. 有两个问题。

First, QUERY_STRING is a separate variable from REQUEST_URI, and so your REQUEST_URI doesn't in fact contain pagespeed. 首先,QUERY_STRING是REQUEST_URI的一个单独变量,因此您的REQUEST_URI实际上不包含pagespeed。

Second, it's case sensitive. 其次,它区分大小写。

So I believe what you meant was 所以我相信你的意思是

RewriteCond %{QUERY_STRING} Pagespeed

Note if you're unsure of the case of the string, or if it could be either, you can use the [NC] flag on the end of RewriteCond to indicate that it's case insensitive. 请注意,如果您不确定字符串的大小写,或者它可能是其中之一,您可以使用RewriteCond末尾的[NC]标志来指示它不区分大小写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM