0

On multiple SEO tests, I am getting a response that

Your site is not using expires headers for all of your images.

However, this is a part of my .htaccess:

htaccess

# Expires Headers
<IfModule mod_expires.c>

    # Enable expirations
    ExpiresActive On

    # Default directive
    ExpiresDefault "access plus 1 month"


    # My favicon
    ExpiresByType image/x-icon "access plus 1 year"

    # Images
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"

    # CSS
    ExpiresByType text/css "access plus 1 month"

    # Javascript
    ExpiresByType application/javascript "access plus 1 year"

</IfModule>

Here are the headers:

Reponse

HTTP/1.1 304 Not Modified
Date: Mon, 29 Jun 2015 09:25:36 GMT
Server: Apache
Connection: Keep-Alive
Keep-Alive: timeout=2, max=100
Expires: Wed, 29 Jul 2015 09:25:36 GMT
Cache-Control: max-age=2592000
Vary: User-Agent

Request

GET /img/tap-logo.png HTTP/1.1
Host: tap.#######.com/
Connection: keep-alive
Pragma: no-cache
Cache-Control: max-age=0
Accept: image/webp,*/*;q=0.8
If-Modified-Since: Tue, 16 Jun 2015 12:23:44 GMT
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36
Referer: http://www.#######.com/
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,en-GB;q=0.6

Why is this not working, and how can it be fixed?

Ben
  • 8,894
  • 7
  • 44
  • 80
  • 2
    Is mod_expires.c module enabled? Please post the headers returned by such a image (e.g. from F12 tools) – ThaDafinser Jun 29 '15 at 09:24
  • How do I know if `mod_expires.c` module is enabled? I've added the details of the headers to my question in an edit. – Ben Jun 29 '15 at 09:27
  • Maybe you fetch images also from different domain / different server and that one doesn't serve the `Expires` header? – Marki555 Jun 29 '15 at 09:40
  • @Marki555 - it's only from a different directory. In the example, the page is `http://tap.example.com/index.php` and the image is `http://tap.example.com/img/tap-logo.png`. The `.htaccess` file is at `http://tap.example.com/.htaccess` – Ben Jun 29 '15 at 09:42
  • This is the only image on that page? Looking at the response headers the `Expires` header is set correctly for this one. That's why I was asking if the page contains also external images – Marki555 Jun 29 '15 at 09:43
  • That is the only image on the page in a `` tag. The others are backgrounds of DIV elements, and their URLs are relative – Ben Jun 29 '15 at 09:49
  • mod_expires is not enabled please enable from apache conf. – Jasmin Mistry Jul 20 '15 at 11:34

0 Answers0