如何在禁用mod_pagespeed </filename>后重定向旧路径(<filename> .pagespeed.ce。{code})

时间:2013-05-29 10:08:34

标签: rewrite mod-pagespeed

我的问题是我在某些目录中禁用了mod_pagespeed,但是抓取工具保存的URL指向pagespeed特殊文件(以.pagespeed.ce。{code}结尾的文件)。以下是错误消息:

[Sun May 26 16:34:22 2013] [error] [mod_pagespeed 1.3.25.4-2941 @15589] Rejected absolute url reference http://www.sansook.in.th/u/2013/05/17/skLrmH.jpg
[Sun May 26 16:34:22 2013] [warn] [mod_pagespeed 1.3.25.4-2941 @15589] [0526/163422:WARNING:resource_fetch.cc(186)] Fetch failed for resource url http://www.sansook.in.th/u/2013/05/17/skLrmH.jpg.pagespeed.ce.TbYJiXXl15.jpg
[Sun May 26 16:34:22 2013] [warn] [mod_pagespeed 1.3.25.4-2941 @15589] Fetch failed for http://www.sansook.in.th/u/2013/05/17/skLrmH.jpg.pagespeed.ce.TbYJiXXl15.jpg, status=404
[Sun May 26 16:34:25 2013] [error] [mod_pagespeed 1.3.25.4-2941 @6364] Rejected absolute url reference http://www.sansook.in.th/u/2013/05/17/skLrmH.jpg
[Sun May 26 16:34:25 2013] [warn] [mod_pagespeed 1.3.25.4-2941 @6364] [0526/163425:WARNING:resource_fetch.cc(186)] Fetch failed for resource url http://www.sansook.in.th/u/2013/05/17/skLrmH.jpg.pagespeed.ce.TbYJiXXl15.jpg
[Sun May 26 16:34:25 2013] [warn] [mod_pagespeed 1.3.25.4-2941 @6364] Fetch failed for http://www.sansook.in.th/u/2013/05/17/skLrmH.jpg.pagespeed.ce.TbYJiXXl15.jpg, status=404
[Sun May 26 16:34:25 2013] [error] [mod_pagespeed 1.3.25.4-2941 @6379] Rejected absolute url reference http://www.sansook.in.th/u/2013/05/17/skLrmH.jpg
[Sun May 26 16:34:25 2013] [warn] [mod_pagespeed 1.3.25.4-2941 @6379] [0526/163425:WARNING:resource_fetch.cc(186)] Fetch failed for resource url http://www.sansook.in.th/u/2013/05/17/skLrmH.jpg.pagespeed.ce.TbYJiXXl15.jpg
[Sun May 26 16:34:25 2013] [warn] [mod_pagespeed 1.3.25.4-2941 @6379] Fetch failed for http://www.sansook.in.th/u/2013/05/17/skLrmH.jpg.pagespeed.ce.TbYJiXXl15.jpg, status=404

我只是想知道是否有任何mod_pagespeed内置功能可以自动重定向无效路径(我之前启用mod的路径,但稍后将其删除)到正确的路径(只需删除.pagespeed.ce。{code})。

有人告诉我,mod_pagespeed通常会默认重写旧路径,只要它已启用。但是,这不适合我的情况。我仍然有mod_pagespeed但它不起作用。以下是我的相关配置:

conf / httpd.conf(部分)

Include conf.d/*.conf

NameVirtualHost 27.254.41.229:80
NameVirtualHost 27.254.41.227:80

<VirtualHost 27.254.41.227:80>
    DocumentRoot /var/www/sansook
    ServerName www.sansook.in.th
    ServerAlias sansook.in.th

    <Directory /var/www/sansook>
        Options -Indexes -Multiviews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    RewriteEngine On
    RewriteCond   %{HTTP_HOST} !^www\.sansook\.in\.th$ [NC]
    RewriteRule   ^(.*)$ http://www.sansook.in.th$1 [L,R=301]
</VirtualHost>

conf.d / pagespeed.conf(已删除,注释已删除)

<IfModule !mod_version.c>
  LoadModule version_module /usr/lib64/httpd/modules/mod_version.so
</IfModule>

<IfVersion < 2.4>
  LoadModule pagespeed_module /usr/lib64/httpd/modules/mod_pagespeed.so
</IfVersion>
<IfVersion >= 2.4.2>
  LoadModule pagespeed_module /usr/lib64/httpd/modules/mod_pagespeed_ap24.so
</IfVersion>

<IfModule !mod_deflate.c>
 LoadModule deflate_module /usr/lib64/httpd/modules/mod_deflate.so
</IfModule>

<IfModule pagespeed_module>
    ModPagespeed on
    ModPagespeedAllow http://www.sansook.in.th/*
    ModPagespeedDisallow http://www.sansook.in.th/u/*
    ModPagespeedDisallow http://www.sansook.in.th/tmp/*

    ModPagespeedInheritVHostConfig on

    AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html

    ModPagespeedFileCachePath            "/var/cache/mod_pagespeed/"

    ModPagespeedRewriteLevel CoreFilters
    ModPagespeedEnableFilters collapse_whitespace,combine_javascript,remove_comments

    ModPagespeedDomain *.sansook.in.th
    ModPagespeedFileCacheInodeLimit        500000
    ModPagespeedAvoidRenamingIntrospectiveJavascript on
    ModPagespeedLibrary 43 1o978_K0_LNE5_ystNklf http://www.modpagespeed.com/rewrite_javascript.js

    <Location /mod_pagespeed_beacon>
          SetHandler mod_pagespeed_beacon
    </Location>
    <Location /mod_pagespeed_statistics>
        Allow from localhost
        Allow from 127.0.0.1
        SetHandler mod_pagespeed_statistics
    </Location>
    <Location /mod_pagespeed_console>
        Order allow,deny
        # This can be configured similarly to mod_pagespeed_statistics above.
        Allow from localhost
        Allow from 127.0.0.1
        SetHandler mod_pagespeed_console
    </Location>
    ModPagespeedMessageBufferSize 100000

    <Location /mod_pagespeed_message>
        Allow from localhost
        Allow from 127.0.0.1
        SetHandler mod_pagespeed_message
    </Location>
    <Location /mod_pagespeed_referer_statistics>
        Allow from localhost
        Allow from 127.0.0.1
        SetHandler mod_pagespeed_referer_statistics
    </Location>
</IfModule>

apachectl -t -D DUMP_MODULES

Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_file_module (shared)
 authn_alias_module (shared)
 authn_anon_module (shared)
 authn_dbm_module (shared)
 authn_default_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 authz_owner_module (shared)
 authz_groupfile_module (shared)
 authz_dbm_module (shared)
 authz_default_module (shared)
 ldap_module (shared)
 authnz_ldap_module (shared)
 include_module (shared)
 log_config_module (shared)
 logio_module (shared)
 env_module (shared)
 ext_filter_module (shared)
 mime_magic_module (shared)
 expires_module (shared)
 deflate_module (shared)
 headers_module (shared)
 usertrack_module (shared)
 setenvif_module (shared)
 mime_module (shared)
 dav_module (shared)
 status_module (shared)
 autoindex_module (shared)
 info_module (shared)
 dav_fs_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 actions_module (shared)
 speling_module (shared)
 userdir_module (shared)
 alias_module (shared)
 substitute_module (shared)
 rewrite_module (shared)
 proxy_module (shared)
 proxy_balancer_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_ajp_module (shared)
 proxy_connect_module (shared)
 cache_module (shared)
 suexec_module (shared)
 disk_cache_module (shared)
 cgi_module (shared)
 version_module (shared)
 unique_id_module (shared)
 jk_module (shared)
 pagespeed_module (shared)
 php5_module (shared)
 ssl_module (shared)
Syntax OK

感谢任何帮助或进一步的调查建议。谢谢!

-Ake

2 个答案:

答案 0 :(得分:0)

如果您保持安装mod_pagespeed但设置为off,它仍会注意到.pagespeed.网址提供相应的资源,但不会执行任何其他操作。 (doc link

答案 1 :(得分:0)

正如Jeff所说,即使您有.pagespeed.,我们也会正确地提供ModPagespeed off资源。但是,我们不会为您提供服务,因为您使用的是ModPagespeedDisallow。在这种情况下,我们似乎应该仍然提供.pagespeed.。我为此开了一个新的错误:https://code.google.com/p/modpagespeed/issues/detail?id=775