Title: Php Errors + Static File Headers + Mobile View Not functioning
Last modified: January 16, 2025

---

# Php Errors + Static File Headers + Mobile View Not functioning

 *  Resolved [Jenny](https://wordpress.org/support/users/enigma666666/)
 * (@enigma666666)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/)
 * I noticed today that the Browser static file caching headers is disabled, even
   though it was previously enabled. **The error on the page is:** “The .htaccess
   file already contains browser static caching settings, but browser caching is
   not functioning as expected. This indicates that your webserver does not support.
   htaccess browser caching rules. To further investigate this, you must contact
   your web hosting provider.” I then clicked the enabled button again and seems
   to work but after a mins it shows the same error and it is disabled again.
 * **So I had a look at the server logs and saw** **Multiple server errors in server
   log throughout the day:**
 * invalid URI path (/wp-content/cache/wpo-minify/1737024527/assets/%url%)
 * [ERROR] : WP_CACHE constant is not present in wp-config.php
 * [ERROR] : Could not turn off the WP_CACHE constant in wp-config.php
 * PHP Warning: file_put_contents(/home/website name/public_html/wp-config.php):
   Failed to open stream: Permission denied in /home/website name/public_html/wp-
   content/plugins/wp-optimize/cache/class-wpo-page-cache.php on line 938
   thrown
   in /home/website name/public_html/wp-includes/widgets/class-wp-widget-block.php
   on line 17
 * **Steps implemented to try and resolve the above issues:**
 * Did a plugin conflict test. It did not help.
 * Cleared cache and minified cache. Exported the settings and then wiped wp-optimze
   settings. This did not help so I re-imported the settings.
 * Checked wp-config and .htaccess file. Regenerated .htaccess file, to see if that
   resolves the issue, it did not.
 * Changed file permissions to see if that resolves the issue, but not helping.
 * Worst of all, when I had a look at the website on my mobile, I saw that the mobile
   view of the website has stopped displaying content and mobile menu and search
   stopped working as well. Content can only be viewed in mobile view if you navigate
   to another page and then go back to the homepage. This must have been going on
   since the last plugin update, because when I now rolled back WP-Optimize plugin
   to the previous version, mobile view is functioning properly again. However the
   Browser static file caching headers are still disabled with the same error mentioned
   in this post, even though I did enable it after I rolled back the plugin.

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Support [vupdraft](https://wordpress.org/support/users/vupdraft/)
 * (@vupdraft)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/#post-18248130)
 * Can you add the following to your wp-config
 *  **define( ‘WP_CACHE’, true );** 
 * Could I have your site URL so I can view it on my mobile?
 *  Thread Starter [Jenny](https://wordpress.org/support/users/enigma666666/)
 * (@enigma666666)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/#post-18248145)
 *  **define( ‘WP_CACHE’, true );**  is already inside wp-config
 * I always had Asynchronously load selected for JavaScript files selected but even
   with previous version of the plugin, the mobile view is now not loading properly.
   If I load js with defer it think it works.
 * Thank you, here is the website link, running on previous version of wp-optimize
   with Asynchronously load selected for JavaScript files: [https://seedsandplants.co.za](https://seedsandplants.co.za)
    -  This reply was modified 1 year, 4 months ago by [Jenny](https://wordpress.org/support/users/enigma666666/).
 *  Thread Starter [Jenny](https://wordpress.org/support/users/enigma666666/)
 * (@enigma666666)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/#post-18248231)
 * I changed the js loading now to defer by enabling option: Use the “defer” html
   attribute , then cleared the homepage page cache and now the mobile view seems
   to be functioning properly again. But the Browser static file caching is still
   disabled – only stays enabled for a few minutes before disabling and showing 
   error message I mentioned earlier. I’m now going to updated to latest version
   of plugin to see if mobile view will still function with js deferred.
 * Ok feedback: I rolled forward/ updated the plugin, and mobile view with js deferred
   did not function properly, did not load content as I described earlier. So I 
   now rolled back the plugin again, keeping js as deferred, but mobile view is 
   now not functioning properly again. What I notice now is that if I go to desktop
   view and clear the page cache for the homepage and I then go on mobile (after
   clearing mobile browser cache), and I visit website on mobile again, it functions
   properly again. So only if I manually clear desktop version of the website’s 
   cache, will the mobile view of the website function properly. If I close mobile
   browser and go to website on mobile again without clearing desktop cache, then
   mobile once again does not function properly.
 * My Conclusion: Deferring js instead of loading js Asynchronously does not make
   a difference, because the issue seems to be related to cache, as mobile only 
   functions when page cache is manually cleared on desktop and once mobile cache
   is cleared on mobile device mobile view once again no longer functions?
    -  This reply was modified 1 year, 4 months ago by [Jenny](https://wordpress.org/support/users/enigma666666/).
    -  This reply was modified 1 year, 4 months ago by [Jenny](https://wordpress.org/support/users/enigma666666/).
    -  This reply was modified 1 year, 4 months ago by [Jenny](https://wordpress.org/support/users/enigma666666/).
 *  Thread Starter [Jenny](https://wordpress.org/support/users/enigma666666/)
 * (@enigma666666)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/#post-18248316)
 * I’ve now disabled Wp-optimize plugin for now until I can find a solution to this
   issue, as I cannot continue to have mobile view not functioning. Without wp-optimize
   the mobile view functions properly.
    -  This reply was modified 1 year, 4 months ago by [Jenny](https://wordpress.org/support/users/enigma666666/).
 *  Plugin Support [vupdraft](https://wordpress.org/support/users/vupdraft/)
 * (@vupdraft)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/#post-18250007)
 * Can you deactivate the Docker cache plugin, I think it might be conflicting (
   at the moment WPO is not doing your caching, the Docker plugin is)
 *  Thread Starter [Jenny](https://wordpress.org/support/users/enigma666666/)
 * (@enigma666666)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/#post-18251464)
 * The Docket cache plugin is only used for object cache using OPcache which is 
   installed on my server. Docket does not cache pages. I already did a conflict
   test by disabling docket plugin and also by disabling cache in Wp-optimize when
   Docket plugin is active. Both methods made no difference with regards to the 
   Expires headers problem in WP-Optimize. Running both wp-optimize and docket object
   cache together does not cause an issue and the 2 plugins seems to work well together.
 * As for mobile display issues, I’ve managed to resolve it by completely deleting
   WP-Optimize plugin and then reinstalling. Reinstalling for some reason fixed 
   the issues with the mobile display, so that is now sorted out and everything 
   is working as it should.
 * The only issue that still remains is the Expires heading setting that keeps on
   disabling, giving me the error I mentioned before. I dont know why this is happening,
   as the code is in my htaccess file:
 *  BEGIN WP-Optimize Browser Cache
 * ExpiresActive On ExpiresByType text/css “access 28 days” ExpiresByType text/html“
   access 28 days” ExpiresByType image/gif “access 28 days” ExpiresByType image/
   png “access 28 days” ExpiresByType image/jpg “access 28 days” ExpiresByType image/
   jpeg “access 28 days” ExpiresByType image/webp “access 28 days” ExpiresByType
   image/x-icon “access 28 days” ExpiresByType application/pdf “access 28 days” 
   ExpiresByType application/javascript “access 28 days” ExpiresByType text/x-javascript“
   access 28 days” ExpiresByType application/x-shockwave-flash “access 28 days” 
   ExpiresDefault “access 28 days”
 * Header set Cache-Control “public” Header set Cache-Control “public” Header set
   Cache-Control “private” Header set Cache-Control “private, must-revalidate” Disable
   ETag
 * FileETag None END WP-Optimize Browser Cache
    -  This reply was modified 1 year, 4 months ago by [Jenny](https://wordpress.org/support/users/enigma666666/).
 *  Plugin Support [vupdraft](https://wordpress.org/support/users/vupdraft/)
 * (@vupdraft)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/#post-18254733)
 * Apologies which expires heading is this?
 *  Thread Starter [Jenny](https://wordpress.org/support/users/enigma666666/)
 * (@enigma666666)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/#post-18257920)
 * Apologies for the late reply. I am referring to what I mentioned in the first
   post on this thread :
 * “the Browser static file caching headers is disabled, even though it was previously
   enabled. **The error on the page is:** “The .htaccess file already contains browser
   static caching settings, but browser caching is not functioning as expected. 
   This indicates that your webserver does not support .htaccess browser caching
   rules. To further investigate this, you must contact your web hosting provider.”
   I then clicked the enabled button again and seems to work but after a mins it
   shows the same error and it is disabled again.”
 * My htaccess file contains the required code for static headers, but the enable
   static file cache headers button inside wp-optimize settings, disables after 
   enabling the button and gives the above error.
 * My htaccess code:
 * BEGIN WP-Optimize Gzip compression Compress HTML, CSS, JavaScript, Text, XML 
   and fonts
 *     ```wp-block-code
           AddType application/vnd.ms-fontobject .eot    AddType font/ttf .ttf    AddType font/otf .otf    AddType font/x-woff .woff     AddType image/svg+xml .svg    AddOutputFilterByType DEFLATE application/javascript    AddOutputFilterByType DEFLATE application/rss+xml    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject    AddOutputFilterByType DEFLATE application/x-font    AddOutputFilterByType DEFLATE application/x-font-opentype    AddOutputFilterByType DEFLATE application/x-font-otf    AddOutputFilterByType DEFLATE application/x-font-truetype    AddOutputFilterByType DEFLATE application/x-font-ttf    AddOutputFilterByType DEFLATE application/x-font-woff    AddOutputFilterByType DEFLATE application/x-javascript    AddOutputFilterByType DEFLATE application/xhtml+xml    AddOutputFilterByType DEFLATE application/xml    AddOutputFilterByType DEFLATE font/opentype    AddOutputFilterByType DEFLATE font/otf    AddOutputFilterByType DEFLATE font/ttf    AddOutputFilterByType DEFLATE font/woff    AddOutputFilterByType DEFLATE image/svg+xml    AddOutputFilterByType DEFLATE image/x-icon    AddOutputFilterByType DEFLATE text/css    AddOutputFilterByType DEFLATE text/html    AddOutputFilterByType DEFLATE text/javascript    AddOutputFilterByType DEFLATE text/plain    AddOutputFilterByType DEFLATE text/xml
       ```
   
 * Remove browser bugs (only needed for really old browsers)
 *     ```wp-block-code
           BrowserMatch ^Mozilla/4 gzip-only-text/html
           BrowserMatch ^Mozilla/4\.0[678] no-gzip
           BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
           <IfModule mod_headers.c>
               Header append Vary User-Agent
           </IfModule>
       </IfModule>
       ```
   
 * END WP-Optimize Gzip compression BEGIN WP-Optimize Browser Cache
 * ExpiresActive On ExpiresByType text/css “access 28 days” ExpiresByType text/html“
   access 28 days” ExpiresByType image/gif “access 28 days” ExpiresByType image/
   png “access 28 days” ExpiresByType image/jpg “access 28 days” ExpiresByType image/
   jpeg “access 28 days” ExpiresByType image/webp “access 28 days” ExpiresByType
   image/avif “access 28 days” ExpiresByType image/x-icon “access 28 days” ExpiresByType
   application/pdf “access 28 days” ExpiresByType application/javascript “access
   28 days” ExpiresByType text/x-javascript “access 28 days” ExpiresByType application/
   x-shockwave-flash “access 28 days” ExpiresDefault “access 28 days”
 * Header set Cache-Control “public” Header set Cache-Control “public” Header set
   Cache-Control “private” Header set Cache-Control “private, must-revalidate” Disable
   ETag
 * FileETag None END WP-Optimize Browser Cache
 *  Thread Starter [Jenny](https://wordpress.org/support/users/enigma666666/)
 * (@enigma666666)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/#post-18258066)
 * If I look at an image using dev/web tools under network tab, I see this response:
 * **Response Header (301B)**
 * HTTP/1.1 200 OK
   Date: Wed, 22 Jan 2025 07:11:12 GMTServer: ApacheCache-Control:
   private Vary: Accept,User-AgentLast-Modified: Sat, 18 Jan 2025 10:54:51 GMTAccept-
   Ranges: bytesContent-Length: 21981Cache-Control: publicKeep-Alive: timeout=5,
   max=95Connection: Keep-AliveContent-Type: image/avif
 * **—->I don’t see Cache-Control: max-age**
 * **—->I don’t see Expires: date and time**
 * **—->I don’t see Etag: date and time**
 * **HOWEVER, I do not get a “leverage browser caching warning” in PageSpeed Insights,
   so I guess the fact that the button in wp-optimize to enable Browser static file
   caching headers** **is not working, does not matter, since code is already inside
   htaccess file? **
 * **I only get a “Serve static assets with an efficient cache policy** **warning”
   in PageSpeed Insights, which shows the problem to be min.css files, which includes
   also wp-optimize’s header and footer min-css files.** **What can I do so that
   these min.css files do not appear under “serve static assets” warning?**
 *  Plugin Support [vupdraft](https://wordpress.org/support/users/vupdraft/)
 * (@vupdraft)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/#post-18259645)
 * Who is your hosting with, have you contacted them?
 * It seems that your server does not support the rules added to your .htaccess
 * Some hosting providers no longer support the use of the .htaccess so it’s worth
   checking this.
 * Also, WPO supports Cloudflare so putting your site behind Clouflare should work
   around this and provide better security for you site. The free plan would do 
   this for you.
 *  Thread Starter [Jenny](https://wordpress.org/support/users/enigma666666/)
 * (@enigma666666)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/#post-18260431)
 * Thank you, but the server is apache and does support the use of htaccess and 
   I also double checked this on the server, so I do not need to contact my hosting
   provider or use Cloudfare.
 * I have now fixed the issue by editing htaccess file code.
 * Thank you for all your patience and assistance, this issue is now resolved.
    -  This reply was modified 1 year, 3 months ago by [Jenny](https://wordpress.org/support/users/enigma666666/).
    -  This reply was modified 1 year, 3 months ago by [Jenny](https://wordpress.org/support/users/enigma666666/).

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Php Errors + Static File Headers + Mobile View Not functioning’ is closed
to new replies.

 * ![](https://ps.w.org/wp-optimize/assets/icon-256x256.png?rev=1552899)
 * [WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance](https://wordpress.org/plugins/wp-optimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-optimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-optimize/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-optimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-optimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-optimize/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [Jenny](https://wordpress.org/support/users/enigma666666/)
 * Last activity: [1 year, 3 months ago](https://wordpress.org/support/topic/php-errors-static-file-headers-mobile-view-not-functioning/#post-18260431)
 * Status: resolved