Different Expires Header for Specific URL

.htaccessapache-2.2

The whole application has a global expires header set in the .htaccess I have a URL e.g. /current which I need like a different expiry header.

Best Answer

Another solution could be to use Apache mod_setenvif and mod_headers to conditionally set cache headers.

SetEnvIf Request_URI "^/current$" OVERRIDE_CACHE_HEADERS=TRUE
Header set Cache-Control no-cache env=OVERRIDE_CACHE_HEADERS

I have not tried this specific configuration, but I have a similar one that sets environment variable with a RewriteRule directive and then uses Header to conditionally change Cache-Control directives

Related Topic