Apache 2.4

4 posts by 3 authors in: Forums > CMS Builder
Last Post: December 27, 2023   (RSS)

My preferred htacces to protect files. Move file match to outer for DRY

# Block access to files that can expose sensitive information.
#
# By default, block access to backup and source files that may be
# left by some text editors and can pose a security risk when anyone
# has access to them.
#
# https://feross.org/cmsploit/
#
# (!) Update the `<FilesMatch>` regular expression from below to
# include any files that might end up on your production server and
# can expose sensitive information about your website. These files may
# include: configuration files, files that contain metadata about the
# project (e.g.: project dependencies), build scripts, etc..

<FilesMatch "(^#.*#|\.(bak|conf|defaultSqlData|dist|dat|fla|htaccess|in[ci]|log|psd|sh|sql|sw[op])|~)(\.php)?$">

    # Apache < 2.3
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
        Satisfy All
    </IfModule>

    # Apache ≥ 2.3
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>

</FilesMatch>
Jeff Shields

Will have a look, I only did the 'fix' so that the htaccess would work ;-)

---



Peace and Long Life

By Dave - December 27, 2023

Hi Guys, 

Thanks for the Apache fix and code streamlining.  That's great, and we'll include both in the next beta.

Cheers! 

Dave Edis - Senior Developer
interactivetools.com