Htaccess regex for all but some file types

I am trying to set a rule in the cgi directory, this works, but I would like to avoid it for .cgi.php and .html filetypes

<Files *>
    SetHandler default-handler
</Files>

Can this exception be added to a regular expression?

+4
source share
1 answer

You need to use FilesMatchwith a negative regex:

<FilesMatch "^(?!.*\.(cgi|php|html)$).*$">
    SetHandler default-handler
</FilesMatch>
+3
source

All Articles