From 1bf42674dfcf7de99b61b948ec2f657cf0414d1d Mon Sep 17 00:00:00 2001 From: OLTC-fperrin Date: Tue, 8 Oct 2024 12:46:59 +0200 Subject: [PATCH] IBX-7818: Fixed direct acces to index.php with long URL (#70) * IBX-7818: Fixed direct acces to index.php with long URL * IBX-7818: Fixed direct acces to index.php with long URL --- resources/templates/apache2/vhost.template | 2 +- resources/templates/nginx/ibexa_params.d/ibexa_rewrite_params | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/templates/apache2/vhost.template b/resources/templates/apache2/vhost.template index 27f4ebf..4484f0b 100644 --- a/resources/templates/apache2/vhost.template +++ b/resources/templates/apache2/vhost.template @@ -100,7 +100,7 @@ RewriteRule ^/(css|js|fonts?)/.*\.(css|js|otf|eot|ttf|svg|woff) - [L] # Prevent access to website with direct usage of index.php in URL - RewriteRule ^/([^/]+/)?index\.php([/?#]|$) - [R=404,L] + RewriteRule ^/([^/]+/)*?index\.php([/?#]|$) - [R=404,L] RewriteRule .* /index.php diff --git a/resources/templates/nginx/ibexa_params.d/ibexa_rewrite_params b/resources/templates/nginx/ibexa_params.d/ibexa_rewrite_params index a0b05a3..1832bfa 100644 --- a/resources/templates/nginx/ibexa_params.d/ibexa_rewrite_params +++ b/resources/templates/nginx/ibexa_params.d/ibexa_rewrite_params @@ -19,7 +19,7 @@ rewrite "^/build/(.*)" "/build/$1" break; rewrite "^/assets/(.*)" "/assets/$1" break; # Prevent access to website with direct usage of index.php in URL -if ($request_uri ~ "^/([^/]+/)?index\.php([/?#]|$)") { +if ($request_uri ~ "^/([^/]+/)*?index\.php([/?#]|$)") { return 404; }