Im trying to migrate my .htaccess file from apache 2.2 to apache 2.4, but i'm having a hard time recreating these deny/allow rules.
#deny access to all files inside folders
SetEnvIf Request_URI "^/.+\.[a-z]+$" deny
SetEnvIf Request_URI "(\.gitignore|\.htaccess)" deny
# set acces to public accessible files in main admin folder
SetEnvIf Request_URI "^/admin/(index\.php|tmp)" allow
# set acces to public accessible files in module folders Admin and Site
SetEnvIf Request_URI "^/modules/[^/]+/(site/([^/]+/)?|admin/)(css|js|plugins|images|files|cache|fonts)/" allow
# set acces to public accessible files in uploads folder
SetEnvIf Request_URI "^/uploads" allow
SetEnvIf Request_URI "^/(.*\.xml|.*\.pdf|.*\.js|.*\.htm|.*\.asp|.*\.html|favicon\.ico|robots\.txt|index\.php|communicationlog\.png|sitemap-?([a-z]+)?\.xml\.?(gz)?$)" allow
Order deny,allow
Deny from env=deny
Allow from env=allow
These are the rules im currently struggling with. It seems very hard to recreate these with the <Require>
, <RequireAll>
and <RequireAny>
directives. Can anyone help us out?
I tried just adding these rule with a <RequireAll>
and <RequireAny>
directives, but these basically deny the entire site and does not reproduce the same results.