mod_rewrite mod_pagespeed RewriteCond
-
29-09-2019 - |
Question
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
OTHER TIPS
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
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]