FilesMatch doesn't work

hi
<FilesMatch “.(?i:pdf)$”>
ForceType application/octet-stream
Header set Content-Disposition attachment
…added to .htaccess but doesn’t work
please help
thanks you

Any major changes to htaccess files need Openlitespeed Restart. Go to Manage Services menu of cyberpanel and then restart Openlitespeed

I really missed to read the codes you mentioned.
Openlitespeed doesnt support this. Rewrite and rewritecond rules are only supported by Openlitespeed.

thanks for reply.
Is there a similar solution compatible with Lightspeed ?
Create a context for example…
And if that is possible…how do i translate this filematch code to context.

You can use this guide to set extra headers on OpenLiteSpeed while using CyberPanel → https://www.cyberhosting.org/how-to-set-custom-extra-headers-for-openlitespeed-while-using-cyberpanel/

1 Like

problem solved :slight_smile:

solution :

context exp:^.*(pdf)$ {
allowBrowse 1
extraHeaders <<<END_extraHeaders
ForceType application/octet-stream
Header set Content-Disposition attachment
END_extraHeaders

rewrite {

}
addDefaultCharset off

phpIniOverride {

}
}

thanks you.

2 Likes

thankss :grinning: :grinning: :grinning: :grinning: