1

I have seen:

ExpiresByType image/jpg "access 1 year"

But also:

ExpiresByType image/jpg "access plus 1 year"

So, what's the difference between those two lines ?

1

These two directives are the same.

The plus keyword is entirely optional. It is just syntactic sugar, to make it (arguably) more "readable".

As stated in the Apache docs for mod_expires:

ExpiresByType type/encoding "base[plus num type] [num type] ..."

:
The plus keyword is optional.

So, include it or not - it is up to you. But, as with everything, it is important to be consistent. Include it OR don't include it; don't mix it.


Aside:

ExpiresByType image/jpg "access 1 year"

As I noted in my answer to your other question, you should probably be using image/jpeg here, not image/jpg.

2
  • Thank you for your answer. One thing to say: I read the apache docs before to understand the plus keyword, but it wasn't clear for me "The plus keyword is optional". In my opinion optional doesn't mean same effect. For me it means that using it you will get this, not using it you will get this. That's why I was confused. – Andrei Jan 15 at 14:48
  • 1
    Yes, it may seem a bit strange that the plus keyword is literally just optional, as in "throw-away" optional. And not "optional" as in an "optional parameter". This alternative syntax is simply for readability, so the additional adjective just makes it read more naturally. (The "normal" syntax is a bit more cryptic and is "rarely" used, but is more machine friendly, eg. ExpiresByType image/jpeg A31536000.) – MrWhite Jan 15 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.