Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

htaccess rules for deny access to php files for both apache 2.2 and 2.4

givanzacedfba21f28
diff --git a/.htaccess b/.htaccess
index 8156d80..b6eeb2f 100755
--- a/.htaccess
+++ b/.htaccess
@@ -1,12 +1,23 @@
-<Files *.php>
- Order Deny,Allow
- Deny from all
-</Files>
+<IfModule !mod_authz_core.c>
+ <Files *.php>
+ Require all denied
+ </Files>
+
+ <Files index.php>
+ Order Allow,Deny
+ Allow from all
+ </Files>
+</IfModule>
+
+<IfModule mod_authz_core.c>
+ <FilesMatch "\.(?i:php)$">
+ Require all denied
+ </FilesMatch>
-<Files index.php>
- Order Allow,Deny
- Allow from all
-</Files>
+ <Files index.php>
+ Require all granted
+ </Files>
+</IfModule>
<IfModule dir_module>
DirectoryIndex index.php
@@ -28,8 +39,7 @@ RewriteBase /
#page cache
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} !.*=.*
-RewriteCond %{HTTP_COOKIE} !^.*(nocache).*$
-#RewriteCond %{QUERY_STRING} !^.*(nocache|admin).*$
+RewriteCond %{HTTP_COOKIE} !^.*(nocache|cart|user|admin).*$
RewriteCond %{QUERY_STRING} !^.*(/admin).*$
RewriteCond %{DOCUMENT_ROOT}/public/page-cache/%{HTTP_HOST}/$1/index.html -f
RewriteRule ^(.*) /public/page-cache/%{HTTP_HOST}/$1/index.html [L]
@@ -72,7 +82,7 @@ RewriteRule ^ index.php [L]
</FilesMatch>
</IfModule>
-FileETag None
+#FileETag None
<IfModule mod_expires.c>
ExpiresActive On
diff --git a/public/.htaccess b/public/.htaccess
index eb05fd3..d95dd48 100755
--- a/public/.htaccess
+++ b/public/.htaccess
@@ -1,14 +1,25 @@
#Options +SymLinksIfOwnerMatch -Indexes
-<Files *.php>
- Order Deny,Allow
- Deny from all
-</Files>
+<IfModule !mod_authz_core.c>
+ <Files *.php>
+ Require all denied
+ </Files>
+
+ <Files index.php>
+ Order Allow,Deny
+ Allow from all
+ </Files>
+</IfModule>
+
+<IfModule mod_authz_core.c>
+ <FilesMatch "\.(?i:php)$">
+ Require all denied
+ </FilesMatch>
-<Files index.php>
- Order Allow,Deny
- Allow from all
-</Files>
+ <Files index.php>
+ Require all granted
+ </Files>
+</IfModule>
<IfModule dir_module>
DirectoryIndex index.php
@@ -29,8 +40,7 @@ RewriteBase /
#page cache
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} !.*=.*
-RewriteCond %{HTTP_COOKIE} !^.*(nocache).*$
-#RewriteCond %{QUERY_STRING} !^.*(nocache|admin).*$
+RewriteCond %{HTTP_COOKIE} !^.*(nocache|cart|user|admin).*$
RewriteCond %{QUERY_STRING} !^.*(/admin).*$
RewriteCond %{DOCUMENT_ROOT}/page-cache/%{HTTP_HOST}/$1/index.html -f
RewriteRule ^(.*) /page-cache/%{HTTP_HOST}/$1/index.html [L]