Header set Cache-Control "no-cache" This " /> Header set Cache-Control "no-cache" This " /> Header set Cache-Control "no-cache" This "/>

Why is some .htaccess <FilesMatch> tutorial usually wrapped within <IfModule mod_headers.c>?

24 views Asked by At

I'd want to configure the cache-control of a file like this.

<FilesMatch "service-worker.js$">
Header set Cache-Control "no-cache"
</FilesMatch>

This works on my server.

However, I've seen several tutorials that do this.

<IfModule mod_headers.c>

<FilesMatch "service-worker.js$">
Header set Cache-Control "no-cache"
</FilesMatch>

</IfModule>

They also have a wrapper named IfModule mod headers.c>.

What's the difference between these two?

What happens if I don't enclose my code within the IfModule?

0

There are 0 answers