Search code examples
.htaccessmod-rewritemod-pagespeed

mod_rewrite mod_pagespeed RewriteCond


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?


Solution

  • 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