mod_rewrite mod_pagespeed RewriteCond

发布于 2024-09-30 19:55:46 字数 479 浏览 0 评论 0原文

我的 .htaccess 文件中有以下内容:

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

服务器管理员已安装 Google mod_pagespeed,当然,因为该文件夹不存在,所以每次尝试访问 /mod_pagespeed_beacon 时都会记录错误(并且没有记录任何统计数据)。

我需要添加什么RewriteCond(以及在哪里)才能使/mod_pagespeed_beacon起作用?

I have the following in my .htaccess file:

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

The server admin has installed Google mod_pagespeed and of course, because the folder doesn't exist, it logs an error every time as it tries to access /mod_pagespeed_beacon (and no stats are logged).

What RewriteCond do I need to add (and where) so /mod_pagespeed_beacon will work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

萤火眠眠 2024-10-07 19:55:46

找到了我的问题的答案。只需添加以下内容:

RewriteCond %{REQUEST_URI} !^/mod_pagespeed_beacon

我认为重写条件列表中的位置并不重要。

-- 编辑

我还需要以下内容来访问统计信息:

RewriteCond %{REQUEST_URI} !^/mod_pagespeed_statistics

Found the answer to my question. Just add the following:

RewriteCond %{REQUEST_URI} !^/mod_pagespeed_beacon

I don't think it matters where in the list of rewrite conditions is goes.

-- Edit

I also needed the following to access the statistics:

RewriteCond %{REQUEST_URI} !^/mod_pagespeed_statistics
凹づ凸ル 2024-10-07 19:55:46

更一般地说,您可以将名称中包含 pagespeed 的所有资源列入白名单:

RewriteCond %{REQUEST_URI} !pagespeed

请参阅新mod_pagespeed 常见问题解答部分

More generally you can whitelist all resources with pagespeed in the name with:

RewriteCond %{REQUEST_URI} !pagespeed

See the new section in the mod_pagespeed FAQ

偏爱自由 2024-10-07 19:55:46

我有 vBulletin 4 Suite + vBSEO
发现.htaccess中的这一行解决了问题

# mod_pagespeed
RewriteCond %{REQUEST_URI} !(mod_pagespeed_statistics|mod_pagespeed_beacon) [NC]

将其放在该行之前

RewriteRule ^(.+)$ vbseo.php [L,QSA]

I have vBulletin 4 Suite + vBSEO
Found that this line in .htaccess sorted out the problem

# mod_pagespeed
RewriteCond %{REQUEST_URI} !(mod_pagespeed_statistics|mod_pagespeed_beacon) [NC]

Place it before this line in

RewriteRule ^(.+)$ vbseo.php [L,QSA]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文