From 4e868e4fcb5cfb8b9b2f621789a54e80c806ce86 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Fri, 29 Apr 2022 20:25:58 +0100 Subject: [PATCH] Use the END mod_rewrite flag instead of L According to the docs in https://httpd.apache.org/docs/current/rewrite/flags.html#flag_l using [L] in an .htaccess context incurs the risk of infinite recursion, which is exactly what we were seeing in production for non-existing .php files. Use [END] instead. --- docker/htaccess | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docker/htaccess b/docker/htaccess index 846f0f32..c4c9f224 100644 --- a/docker/htaccess +++ b/docker/htaccess @@ -10,7 +10,7 @@ RewriteBase / #RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$ #RewriteRule ^(.*)$ http://cavallette.noblogs.org/2013/11/8487 [R,L] -RewriteRule ^index\.php$ - [L] +RewriteRule ^index\.php$ - [END] #### moved blogs. RewriteCond %{HTTP_HOST} ^ventitre\.noblogs\.org [NC] @@ -28,11 +28,11 @@ RewriteRule ^resource/[^/]+/preview/(.*)$ wp-includes/ms-files.php?file=2010/08/ RewriteRule ^resource/[^/]+/download/(.*)$ wp-includes/ms-files.php?file=2010/08/$1 [L] # hardening of wp-includes (with the exception of ms-files.php, the WP multisite file server). -RewriteRule ^wp-admin/includes/ - [F,L] +RewriteRule ^wp-admin/includes/ - [F,END] RewriteRule !^wp-includes/ - [S=2] RewriteCond $0 !^wp-includes/ms-files\.php$ -RewriteRule ^wp-includes/.+\.php(/|$) - [F,L] -RewriteRule ^wp-includes/theme-compat/ - [F,L] +RewriteRule ^wp-includes/.+\.php(/|$) - [F,END] +RewriteRule ^wp-includes/theme-compat/ - [F,END] # BEGIN WPSuperCache <IfModule mod_rewrite.c> @@ -72,10 +72,10 @@ RewriteRule ^(.*) "/wp-content/cache/supercache/%{HTTP_HOST}/%{HTTP:X-Forwarded- # BEGIN WordPress RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d -RewriteRule ^ - [L] -RewriteRule ^(wp-(content|admin|includes).*) $1 [L] -RewriteRule ^(.*\.php)$ $1 [L] -RewriteRule . index.php [L] +RewriteRule ^ - [END] +RewriteRule ^(wp-(content|admin|includes).*) $1 [END] +RewriteRule ^(.*\.php)$ $1 [END] +RewriteRule . index.php [END] # END WordPress # BEGIN noblogs -- GitLab