Can you check this htaccess code please

DigNap15

Fan
Joined
Sep 14, 2019
Messages
724
Hello
Here is part of my htaccess code
Could you plese tell me which is the right format for this piece of code
Either
Header set Cache-Control "no-cache, private"
Or
<IfModule mod_headers.c>
Header set Cache-Control "no-cache, private"
</IfModule>

Ie does the code need to have ifModule brackets?
 

Pete

Flavours of Forums Forever
Joined
Sep 9, 2013
Messages
2,694
If you are *sure* that mod_headers is enabled in Apache, the first is fine.

If you are not sure, the latter checks and only tries to use the features if present. If you are in any way unsure, use the latter because trying to use the Headers feature without the module in place just makes your site go 500 Internal Server Error.
 

DigNap15

Fan
Joined
Sep 14, 2019
Messages
724
Thanks
I would not know where to check if Apache has mod-headers enabled.

So following you advice I have entered the code in full.
 
Top