I am working on SEO and need to verify that Image Headers Expires is working. Both modules for expires and headers are installed and enabled.
Any ideas?
The .htaccess file has this in it
<IfModule mod_expires.c>
ExpiresByType application/javascript "access plus 2 days"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 2 days"
</IfModule>
I have added this to both the wordpress/ directory and the wordpress/wp-content/ directory.
And yet the SEO tool is saying "Your server is not using expires header for your images."
to test using curl I have done
Date: Sun, 15 Jan 2023 04:31:01 GMT
Server: Apache
Location: https://www.jaycocioservices.com/about
Content-Type: text/html; charset=iso-8859-1
You are missing the
ExpiresActivedirective to enable the generation of the relevantExpiresandCache-Controlheaders.You don't need the
<IfModule>wrapper - this is only going to mask the error if mod_expires is not installed.You don't need the
ExpiresByType image/jpg ...directive since the correct mime-type isimage/jpeg, which you already have in the directive that follows.You don't need to repeat these directives in both the
/wordpressand/wordpress/wp-contentdirectories. Placing these directives in the root.htaccessfile should be sufficient and naturally applies to all subdirectories.Also consider setting an
ExpiresDefaultdirective for all other mime-types.For example:
That looks like a redirect response (due to the presence of the
Locationheader), which perhaps should not be cached anyway (or left to the browser default in the case of a 301). Make sure you are requesting the canonical URL to test.This (
/abouttext/html) is also for a request not covered by your existing mod_expires directives. You need to be requesting an image, CSS or JS file.