What's the difference between access and access plus in ExpiresByType directive?

What's the difference between access and access plus in ExpiresByType directive? - .htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about htaccess, apache, cache, cache-control, .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :


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 ?


Solution :

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.


Additionally, if you would like to do some further testing, give the htaccess tester tool a try. It allows you to specify a certain URL as well as the rules you would like to include and then shows which rules were tested, which ones met the criteria, and which ones were executed.

Comments

Popular posts from this blog

Rewrite in Mediawiki, remove index.php, .htaccess

.htaccess rewrite wildcard folder paths from host

Using .htaccess to set a cookie and 301 redirect