Mod page issue on Apache / Wordpress 404 error

743 views
Skip to first unread message

John M

unread,
Feb 11, 2018, 9:40:24 AM2/11/18
to mod-pagespeed-discuss
Hello there,
So i recently found out about this module on apache so i decided to install on friday.
SInce then i had lots of issue with it, so today i decided to turn off the module.
I have tried multiple conf on htaccess but in the end all of them broke my website.
For ex this is the last 

Options +FollowSymLinks
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType text/css "access 1 month"
    ExpiresByType text/html "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 1 month"

</IfModule>



#Begin gzip and deflate
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css application/x-javascript text/plain text/xml image/x-icon
</IfModule>

<IfModule mod_pagespeed_ap24.c>
    ModPagespeed off
    ModPagespeedEnableFilters rewrite_css,combine_css
    ModPagespeedEnableFilters recompress_images
    ModPagespeedEnableFilters collapse_whitespace,remove_comments
</IfModule> 
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^index\.php$ - [L]
 RewriteRule ^favicon.ico$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
###- Hosting Optimization -###
### Start
<IfModule mod_headers.c>
  Header unset ETag
  FileETag None
</IfModule>
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/phtml
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE text/javascript
</IfModule>
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault A0
  <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
    ExpiresDefault A29030400
    Header append Cache-Control "public"
  </FilesMatch>
  <FilesMatch "\.(gif|jpg|jpeg|js|png|swf|css)$">
    ExpiresDefault A604800
    Header append Cache-Control "public"
  </FilesMatch>
  <FilesMatch "\.(xml|txt|html)$">
    ExpiresDefault A7200
    Header append Cache-Control "proxy-revalidate"
  </FilesMatch>
  <FilesMatch "\.(php|cgi|pl|htm)$">
    ExpiresActive Off
    Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
    Header set Pragma "no-cache"
  </FilesMatch>
</IfModule>
### End
# php -- BEGIN cPanel-generated handler, do not edit
# NOTE this account's php is controlled via FPM and the vhost, this is a place holder.
# Do not edit. This next line is to support the cPanel php wrapper (php_cli).
# AddType application/x-httpd-ea-php70 .php .phtml
# php -- END cPanel-generated handler, do not edit
# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
<IfModule php7_module>
   php_flag display_errors Off
   php_value max_execution_time 600
   php_value max_input_time 300
   php_value max_input_vars 2000
   php_value memory_limit 512M
   php_value post_max_size 110M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php70"
   php_value upload_max_filesize 100M
   php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives, do not edit



But i had some good experience too, for ex i set some module filters on and the website worked perfectly on all browsers (even mobile browsers) but after 5-7 hours i started to get 404 not found on google console and instead of pictures there was text.
Can someone help me with this?
Before using google pagespeed module i was using a plugin for cache named wp rocket. First i though it was from it that i keep having this 404 errors, but i disable it and without luck.
Waiting for your answer, thanks in advanced.

Otto van der Schaaf

unread,
Feb 11, 2018, 10:00:31 AM2/11/18
to mod-pagesp...@googlegroups.com
I suspect one of the scripts on the page somehow badly breaks when combine_javascript is enabled. You could try disabling that filter to see if the script errors go away.

Otto

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/0c8c3ab9-536f-459d-8ed0-ea86f17142c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John M

unread,
Feb 11, 2018, 10:04:14 AM2/11/18
to mod-pagespeed-discuss
Thanks for reply Otto, indeed that fixes the problem, but after some time the issue comes back with all those 404 erros. I tried multiple enable/disable filters, but without luck.

Otto van der Schaaf

unread,
Feb 11, 2018, 10:18:58 AM2/11/18
to mod-pagesp...@googlegroups.com
To me it looks like the module isn't consistently able to fetch its inputs. To debug, I'd
take a close look at the access logs, error logs, and pagespeed's admin interface.

Alternatively, you could skip all that and try to set up directly loading files from disk:
This comes with other perks too: it's pretty efficient, and the module will be able to instantly
react to updates to original resources. 

Otto

On Sun, Feb 11, 2018 at 4:04 PM John M <ionut....@gmail.com> wrote:
Thanks for reply Otto, indeed that fixes the problem, but after some time the issue comes back with all those 404 erros. I tried multiple enable/disable filters, but without luck.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

John M

unread,
Feb 11, 2018, 8:23:42 PM2/11/18
to mod-pagespeed-discuss
Hey Otto i have activated direct load files, and i also activated the wp rocket module for cache.
Here are some logs, maybe you can help me on what should i do to avoid getting so many requests.
Thanks in advanced.

Otto van der Schaaf

unread,
Feb 12, 2018, 7:54:14 AM2/12/18
to mod-pagesp...@googlegroups.com
I'm not sure what you are asking, I don't see that may requests... 
But looking at the log you posted, there are some "too busy" messages in there which just mean that mod_pagespeed 
is still working on crunching images in the background. I think that is fine, as long as it is transient. 

Otto

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

John M

unread,
Feb 12, 2018, 7:56:59 AM2/12/18
to mod-pagespeed-discuss
I also have some red requests.
Like this one 

[Mon, 12 Feb 2018 12:55:10 GMT] [Warning] [9584] Fetch failed for /wp-content/cache/busting/1/wp-includes,_js,_jquery,_jquery-migrate.min-1.4.1.js+wp-content,_plugins,_woocommerce-multilingual,_res,_js,_front-scripts.min-4.2.9.js.pagespeed.jc.O7UBAjt5Dv.js, status=404
[Mon, 12 Feb 2018 12:55:10 GMT] [Warning] [9584] wp-content/cache/busting/1/wp-includes,_js,_jquery,_jquery-migrate.min-1.4.1.js+wp-content,_plugins,_woocommerce-multilingual,_res,_js,_front-scripts.min-4.2.9.js.pagespeed.jc.O7UBAjt5Dv.js resource_404_count: not found (404)


Message has been deleted

John M

unread,
Feb 16, 2018, 11:44:09 AM2/16/18
to mod-pagespeed-discuss
Hello again Otto, i don't know exactly what is happening with pagespeed mode on my wordpress, but for ex today is working and the 2nd day all i get is 404 errors resource not found, and my website is not working properly.
I will attach latest logs and also a screenshoot from chrome inspector.

 Pagespeedmode logs: https://pastebin.com/N34tN26w
Htaccess filters: 
# LBROWSERCSTART Browser Caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif "access 1 year"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/javascript "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/xhtml-xml "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresDefault "access 1 month"
</IfModule>
# END Caching LBROWSERCEND
<IfModule pagespeed_module>
  # Turn on mod_pagespeed. To completely disable mod_pagespeed, you
  # can set this to "off".
  ModPagespeed on
ModPagespeedEnableFilters add_head
ModPagespeedEnableFilters inline_images
ModPagespeedEnableFilters inline_javascript
ModPagespeedEnableFilters rewrite_images
ModPagespeedDomain botezdepoveste.ro
ModPagespeedEnableFilters local_storage_cache
</Ifmodule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^index\.php$ - [L]
 RewriteRule ^favicon.ico$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !pagespeed
Maybe i don't do something idk...but like i said today is working perfectly and after a couple of hours i get that 404 errors.
And i have done what you said regarding using local resourc

Capture.PNG

Otto van der Schaaf

unread,
Feb 16, 2018, 5:34:13 PM2/16/18
to mod-pagesp...@googlegroups.com
Looking at the source with ?PageSpeedFilters=+debug I see a lot of comments like:

Assuming these exist on disk: Are you sure you configured LoadFromFile correctly? 

Otto

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

John M

unread,
Feb 17, 2018, 12:50:32 PM2/17/18
to mod-pagespeed-discuss
The host told me that they set the path to wp-content and i'm using a cache plugin (wp -rocket) for transforming dynamic to static.
But like i said it takes about 3-4 hours to get 404 erros in console
[Sat, 17 Feb 2018 17:43:54 GMT] [Warning] [21752] x/wp-content/cache/busting/1/wp-includes,_js,_jquery,_jquery-migrate.min-1.4.1.js+wp-content,_plugins,_woocommerce-multilingual,_res,_js,_front-scripts.min-4.2.9.js.pagespeed.jc.O7UBAjt5Dv.js resource_404_count: not found (404)
[Sat, 17 Feb 2018 17:43:54 GMT] [Warning] [21752] Fetch failed for x/wp-content/cache/busting/1/wp-includes,_js,_jquery,_jquery-migrate.min-1.4.1.js+wp-content,_plugins,_woocommerce-multilingual,_res,_js,_front-scripts.min-4.2.9.js.pagespeed.jc.O7UBAjt5Dv.js, status=404
[Sat, 17 Feb 2018 17:43:54 GMT] [Info] [21752] HTTPCache key=x/wp-content/cache/busting/1/wp-content/plugins/woocommerce-multilingual/res/js/front-scripts.min-4.2.9.js fragment=botezdepoveste.ro: remembering recent failure for 228 seconds.
[Sat, 17 Feb 2018 17:43:54 GMT] [Info] [21752] HTTPCache key=x/wp-content/cache/busting/1/wp-includes/js/jquery/jquery-migrate.min-1.4.1.js fragment=botezdepoveste.ro: remembering recent failure for 227 seconds.
[Sat, 17 Feb 2018 17:43:53 GMT] [Warning] [21752] x/wp-content/cache/busting/1/wp-includes,_js,_jquery,_jquery-migrate.min-1.4.1.js+wp-content,_plugins,_woocommerce-multilingual,_res,_js,_front-scripts.min-4.2.9.js.pagespeed.jc.O7UBAjt5Dv.js resource_404_count: not found (404)
[Sat, 17 Feb 2018 17:43:53 GMT] [Warning] [21752] Fetch failed for x/wp-content/cache/busting/1/wp-includes,_js,_jquery,_jquery-migrate.min-1.4.1.js+wp-content,_plugins,_woocommerce-multilingual,_res,_js,_front-scripts.min-4.2.9.js.pagespeed.jc.O7UBAjt5Dv.js, status=404


 ModPagespeedMapOriginDomain http://localhost https://www.website.ro
&
ModPagespeedLoadFromFile "http://www.x.ro/wp-content/" \
"/home/website/public_html/wp-content/"

Any ideas on what should i do ? 
Thanks in advance, waiting for your answer.

Otto van der Schaaf

unread,
Feb 17, 2018, 1:01:44 PM2/17/18
to mod-pagesp...@googlegroups.com
I'd try to prove out that the module's fetching path(s) are working, either via https or LoadFromFile.

While doing that it may help to:
- purge the cache after configuration changes to get rid of remembered fetching failures / force the input resources to be
  fetched again.
- turn off IPRO to get consistent behavior and (the module has to rely 100% on the fetching paths to get to its resources)
- tail the access logs if http(s) fetching is used. any requests mentioning mod_pagespeed in the user-agent are interesting
  to track.

Otto


--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

John M

unread,
Feb 22, 2018, 12:03:47 PM2/22/18
to mod-pagespeed-discuss
Hey again Otto i have done what you've told me.. but without luck...
So about 2 days ago i have decided to use only rewrite images in htaccess.
All worked perfectly until now when i got again 404 errors.
I don't know what to do... this mod pagespeed seems to be uncompatible with wordpress or idk how to cofigure ...
So the only line in htaccess is for images rewrite...and all js on server are 404.
Waiting for your advice and thanks in advance.
Capture.PNG

Yawer Malik

unread,
Feb 26, 2019, 10:14:59 AM2/26/19
to mod-pagespeed-discuss
Here's the best guide to get WordPress 404 error fixed, It can become a source of confusion, hence, I am going to educate individuals on how they can quickly resolve 403 forbidden WordPress error on their WordPress websites.
Reply all
Reply to author
Forward
0 new messages