diff --git a/.htaccess b/.htaccess
index defe7f3b6c..db7778a520 100755
--- a/.htaccess
+++ b/.htaccess
@@ -4,23 +4,22 @@
DirectoryIndex index.php index.html
-# PROTECTED DIRECTORIES
RewriteEngine On
- RewriteCond %{REQUEST_FILENAME} -d
- RewriteRule (?i)(data|api) - [F]
-
-RedirectMatch 403 (?i)/data/config\.php$
-RedirectMatch 403 (?i)/data/logs
-RedirectMatch 403 (?i)/data/cache
-RedirectMatch 403 (?i)/data/upload
-RedirectMatch 403 (?i)/application
-RedirectMatch 403 (?i)/custom
-RedirectMatch 403 (?i)/vendor
-#END PROTECTED DIRECTORIES
-
- RewriteEngine On
+ # PROTECTED DIRECTORIES
+ RewriteCond %{REQUEST_FILENAME} -d
+ RewriteRule ^/?(data|api)/ - [F]
+
+ RewriteRule ^/?data/config\.php$ - [F]
+ RewriteRule ^/?data/logs/ - [F]
+ RewriteRule ^/?data/cache/ - [F]
+ RewriteRule ^/?data/upload/ - [F]
+ RewriteRule ^/?application/ - [F]
+ RewriteRule ^/?custom/ - [F]
+ RewriteRule ^/?vendor/ - [F]
+ #END PROTECTED DIRECTORIES
+
RewriteRule .* - [E=HTTP_ESPO_CGI_AUTH:%{HTTP:Authorization}]
RewriteRule reset/?$ reset.html [QSA,L]
diff --git a/frontend/client/custom/.data b/frontend/client/custom/.data
new file mode 100644
index 0000000000..0519ecba6e
--- /dev/null
+++ b/frontend/client/custom/.data
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/install/core/SystemHelper.php b/install/core/SystemHelper.php
index 21da1c5b1f..aad7ee7554 100644
--- a/install/core/SystemHelper.php
+++ b/install/core/SystemHelper.php
@@ -279,7 +279,7 @@ class SystemHelper extends \Espo\Core\Utils\System
$serverType = $this->getServerType();
$rules = array(
- 'nginx' => "location /api/v1/ {\n if (!-e " . '$request_filename' . "){\n rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;\n }\n}\n\nlocation / {\n rewrite reset/?$ reset.html break;\n}\n\nlocation /(data|api) {\n if (-e " . '$request_filename' . "){\n return 403;\n }\n}\n\nlocation /data/logs {\n return 403;\n}\nlocation /data/config.php$ {\n return 403;\n}\nlocation /data/cache {\n return 403;\n}\nlocation /data/upload {\n return 403;\n}\nlocation /application {\n return 403;\n}\nlocation /custom {\n return 403;\n}\nlocation /vendor {\n return 403;\n}",
+ 'nginx' => "location /api/v1/ {\n if (!-e " . '$request_filename' . "){\n rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;\n }\n}\n\nlocation / {\n rewrite reset/?$ reset.html break;\n}\n\nlocation ^~ (data|api)/ {\n if (-e " . '$request_filename' . "){\n return 403;\n }\n}\n\nlocation ^~ /data/logs/ {\n return 403;\n}\nlocation ^~ /data/config.php {\n return 403;\n}\nlocation ^~ /data/cache/ {\n return 403;\n}\nlocation ^~ /data/upload/ {\n return 403;\n}\nlocation ^~ /application/ {\n return 403;\n}\nlocation ^~ /custom/ {\n return 403;\n}\nlocation ^~ /vendor/ {\n return 403;\n}",
);
if (isset($rules[$serverType])) {
diff --git a/web.config b/web.config
index b82810acac..6baebe63d7 100644
--- a/web.config
+++ b/web.config
@@ -5,35 +5,35 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+